/* Prevent horizontal page scroll on small screens (does NOT break sticky nav,
   unlike overflow-x: hidden which creates a scroll container). */
html, body { overflow-x: clip; }

/* ---- Accessibilité : focus clavier toujours visible (jamais outline:none sans
   remplacement). Le ring apparaît au CLAVIER uniquement (:focus-visible),
   pas au clic souris. ---- */
:focus-visible {
  outline: 2px solid #2d6a4f;
  outline-offset: 2px;
}
.admin-nav-link:focus-visible { outline-color: #74c69d; outline-offset: -2px; }

/* ---- Interaction tactile : supprime le délai de double-tap sur les cibles ---- */
a, button, select, label, summary { touch-action: manipulation; }

/* ---- Chiffres alignés (montants FCFA, compteurs, tableaux comparatifs) ---- */
.tnum { font-variant-numeric: tabular-nums; }

.prose-fenum h1, .prose-fenum h2, .prose-fenum h3 {
  font-family: 'Fraunces', serif;
  color: #1b4332;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  font-weight: 600;
}
.prose-fenum h1 { font-size: 1.6rem; }
.prose-fenum h2 { font-size: 1.3rem; }
.prose-fenum h3 { font-size: 1.1rem; }
.prose-fenum p { margin-bottom: 0.9em; line-height: 1.7; }
.prose-fenum ul, .prose-fenum ol { margin: 0.6em 0 0.9em 1.4em; }
.prose-fenum ul { list-style: disc; }
.prose-fenum ol { list-style: decimal; }
.prose-fenum table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.92rem; }
.prose-fenum th, .prose-fenum td { border: 1px solid #d9d0bd; padding: 0.5em 0.7em; text-align: left; }
.prose-fenum th { background: #f3ede1; font-weight: 600; }
.prose-fenum code { background: #f3ede1; padding: 0.1em 0.4em; border-radius: 0.3em; font-size: 0.88em; }
.prose-fenum blockquote { border-left: 3px solid #ca8a04; padding-left: 1em; color: #44403c; font-style: italic; }

.grain-texture {
  background-image: radial-gradient(#1b4332 0.6px, transparent 0.6px);
  background-size: 16px 16px;
  opacity: 0.06;
}

/* ---- Interactive admin navigation ---- */
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(27 67 50 / 0.78);
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.admin-nav-link:hover {
  background: rgb(231 244 237 / 0.9);
  color: rgb(21 46 34);
}
.admin-nav-link .nav-ico { color: rgb(27 67 50 / 0.55); transition: color .18s ease, transform .18s ease; }
.admin-nav-link:hover .nav-ico { color: rgb(63 136 98); transform: translateX(1px); }
.admin-nav-link.is-active {
  background: #1b4332;
  color: #f3ede1;
}
.admin-nav-link.is-active .nav-ico { color: #74c69d; }
.admin-nav-link.is-active:hover { background: #152e22; color: #fff; }

/* ---- Mobile drawer (Alpine) ---- */
[x-cloak] { display: none !important; }
.drawer-backdrop { transition: opacity .25s ease; }
.drawer-backdrop[x-cloak] { opacity: 0; }
.drawer-panel {
  transition: transform .28s cubic-bezier(.22,.61,.36,1);
  overscroll-behavior: contain;
}
.drawer-panel.closed { transform: translateX(-100%); }

/* ---- Responsive tables ---- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 640px; }

/* ---- Card micro-interaction ---- */
.card-hover {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -12px rgb(21 46 34 / 0.25);
  border-color: rgb(45 106 79 / 0.35);
}

/* ---- Hide scrollbar (horizontal mobile nav) ---- */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ---- Touch-friendly tap targets on mobile ---- */
@media (max-width: 640px) {
  .tap-target { min-height: 44px; }
}

/* ---- Reveal-on-load animation (dashboard / team surfaces) ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.rise { animation: rise .5s cubic-bezier(.22,.61,.36,1) both; }
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  /* Toutes les animations non essentielles s'arrêtent (guidelines Vercel). */
  .card-hover, .drawer-panel, .drawer-backdrop,
  .admin-nav-link, .admin-nav-link .nav-ico { transition: none !important; }
  .card-hover:hover { transform: none; }
  .admin-nav-link:hover .nav-ico { transform: none; }
}

/* ---- htmx : état de chargement du bouton pendant la requête ---- */
button[type="submit"]:disabled { opacity: .6; cursor: wait; }

/* ---- Impression / Export PDF (vue bilan) ---- */
@media print {
  aside, .no-print, .drawer-backdrop, .drawer-panel,
  .mobile-subbar { display: none !important; }
  html, body { overflow: visible !important; background: #fff !important; }
  .max-w-7xl { max-width: 100% !important; }
  .flex.flex-col.md\:flex-row { display: block !important; }
  .shadow-xl, .rounded-2xl { box-shadow: none !important; }
  .bg-white { background: #fff !important; }
  .text-forest-900\/40, .text-forest-900\/50, .text-forest-900\/60 { color: #44403c !important; }
  a[href]:after { content: ""; }
  @page { margin: 1.4cm; }
}
