/* =========================================================
   PORTAIL METFP — Feuille de style
   Palette institutionnelle dérivée du logo officiel :
   vert engrenage, blanc dominant, rouge vif, bleu de confiance.
   ========================================================= */

/* ---------- Jetons de design (thème clair par défaut) ---------- */
:root {
  /* Couleurs de marque */
  --brand-green: #0B5A2E;      /* vert engrenage du logo */
  --brand-green-600: #0F6E39;
  --brand-red: #D62027;        /* rouge vif du logo */
  --brand-red-600: #B71A20;
  --brand-blue: #1D4E89;       /* bleu institutionnel / confiance */

  /* Surfaces & texte */
  --bg: #F5F7F6;
  --bg-soft: #ECF1EE;
  --surface: #FFFFFF;
  --surface-2: #FBFCFB;
  --border: #E2E8E4;
  --text: #14211B;
  --text-muted: #5B6B63;
  --text-soft: #7A897F;

  /* États */
  --ok: #16A34A;
  --ok-soft: rgba(22, 163, 74, 0.12);
  --wip: #E0A006;
  --wip-soft: rgba(224, 160, 6, 0.14);

  /* Effets */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 33, 27, 0.05);
  --shadow: 0 6px 20px rgba(20, 33, 27, 0.07);
  --shadow-lg: 0 18px 48px rgba(20, 33, 27, 0.13);
  --ring: 0 0 0 4px rgba(11, 90, 46, 0.18);

  --header-grad: linear-gradient(135deg, #0B5A2E 0%, #0F6E39 55%, #14814A 100%);
  --maxw: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Thème sombre ---------- */
[data-theme="dark"] {
  --bg: #0C1512;
  --bg-soft: #0F1A16;
  --surface: #14211B;
  --surface-2: #182A22;
  --border: #274036;
  --text: #EAF1EC;
  --text-muted: #A7BCB0;
  --text-soft: #7F978A;

  --ok-soft: rgba(34, 197, 94, 0.16);
  --wip-soft: rgba(224, 160, 6, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 4px rgba(34, 197, 94, 0.28);

  --header-grad: linear-gradient(135deg, #08351B 0%, #0B4A29 55%, #0E5A34 100%);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* aucun débordement horizontal */
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

h1, h2, h3 {
  font-family: "Sora", "Inter", sans-serif;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

/* Accessibilité : focus clairement visible */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* Lien d'évitement pour lecteurs d'écran / clavier */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--brand-green);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: relative;
  background: var(--header-grad);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}

/* Motif d'engrenages subtil en arrière-plan (évoque le logo) */
.site-header::before,
.site-header::after {
  content: "\f085"; /* fa-gears */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  color: rgba(255, 255, 255, 0.06);
  z-index: -1;
  pointer-events: none;
}
.site-header::before { font-size: 20rem; top: -5rem; right: -4rem; }
.site-header::after  { font-size: 12rem; bottom: -4rem; left: -3rem; transform: rotate(18deg); }

/* Barre supérieure : logo + bascule thème */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.brand__logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #fff;
  padding: 6px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.brand__logo img { width: 100%; height: 100%; object-fit: contain; }
.brand__acronym {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  line-height: 1.05;
}
.brand__gov {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.02em;
}

/* Bouton bascule mode sombre */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.22); transform: rotate(-18deg) scale(1.05); }
.theme-toggle .fa-sun { display: none; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }

/* Bloc titre principal du header */
.hero {
  padding-block: clamp(2.2rem, 6vw, 4.2rem) clamp(3rem, 7vw, 5rem);
  max-width: 780px;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.4rem;
}
.hero__eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-red);
  box-shadow: 0 0 0 4px rgba(214, 32, 39, 0.35);
}
.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 800;
}
.hero h1 .accent { color: #FFD7B0; }
.hero__subtitle {
  margin-top: 1.1rem;
  font-size: clamp(1rem, 2.3vw, 1.18rem);
  color: rgba(255, 255, 255, 0.9);
  max-width: 60ch;
}

/* Bande décorative tricolore (blanc / rouge / vert) en bas du header */
.header-stripe {
  display: flex;
  height: 6px;
}
.header-stripe span { flex: 1; }
.header-stripe span:nth-child(1) { background: #ffffff; }
.header-stripe span:nth-child(2) { background: var(--brand-red); }
.header-stripe span:nth-child(3) { background: var(--brand-green-600); }

/* =========================================================
   SECTION PRINCIPALE — outils + grille des cartes
   ========================================================= */
main { padding-block: clamp(2.4rem, 6vw, 4rem); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 2.2rem;
}
.toolbar__intro { min-width: 0; }
.toolbar__intro h2 {
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  font-weight: 700;
}
.toolbar__intro p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Compteur du nombre total de plateformes */
.counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.counter-pill strong { color: var(--brand-green); font-weight: 700; }
[data-theme="dark"] .counter-pill strong { color: #4ADE80; }

/* Barre de recherche */
.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 420px;
}
.search__icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 0.95rem 3rem 0.95rem 3rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.98rem;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.search input::placeholder { color: var(--text-soft); }
.search input:focus {
  border-color: var(--brand-green);
  box-shadow: var(--ring);
}
.search__clear {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-soft);
  border: none;
  color: var(--text-muted);
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.search__clear.is-visible { display: inline-flex; }
.search__clear:hover { background: var(--brand-red); color: #fff; }

/* Grille responsive : 3 colonnes desktop / 2 tablette / 1 mobile */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
}

/* ---------- Carte application ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);

  /* état initial pour l'apparition progressive (fade-in) */
  opacity: 0;
  transform: translateY(18px);
}
.card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Liseré coloré qui se révèle en haut de la carte au survol */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--brand-green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.card:hover::before { transform: scaleX(1); }

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.5rem;
  color: var(--brand-green);
  background: var(--bg-soft);
  flex-shrink: 0;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
}
[data-theme="dark"] .card__icon { color: #6EE7A5; }
.card:hover .card__icon {
  transform: scale(1.08) rotate(-4deg);
  background: var(--brand-green);
  color: #fff;
}

/* Badge d'état */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge .status-dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.badge--ok { color: var(--ok); background: var(--ok-soft); }
.badge--ok .status-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.badge--wip { color: var(--wip); background: var(--wip-soft); }
.badge--wip .status-dot { background: var(--wip); box-shadow: 0 0 0 3px var(--wip-soft); }
/* pulsation douce du point « en cours » */
.badge--wip .status-dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.card__name {
  font-size: 1.18rem;
  font-weight: 700;
}
.card__fullname {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-soft);
}
.card__desc {
  margin: 0.7rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.94rem;
  flex-grow: 1;
}

/* Bouton d'accès */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn i { transition: transform 0.25s var(--ease); }
.btn--primary {
  background: var(--brand-green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 90, 46, 0.28);
}
.btn--primary:hover {
  background: var(--brand-green-600);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(11, 90, 46, 0.34);
}
.btn--primary:hover i { transform: translateX(4px); }
.btn--disabled {
  background: var(--bg-soft);
  color: var(--text-soft);
  border-color: var(--border);
  cursor: not-allowed;
}
.btn--disabled i { color: var(--wip); }

/* Message « aucun résultat » pour la recherche */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
  display: none;
}
.empty-state.is-visible { display: block; }
.empty-state i { font-size: 2.4rem; color: var(--text-soft); margin-bottom: 0.8rem; }
.empty-state p { margin: 0.3rem 0; }
.empty-state strong { color: var(--text); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
.footer-stripe { display: flex; height: 4px; }
.footer-stripe span { flex: 1; }
.footer-stripe span:nth-child(1) { background: #ffffff; }
.footer-stripe span:nth-child(2) { background: var(--brand-red); }
.footer-stripe span:nth-child(3) { background: var(--brand-green); }

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  padding-block: clamp(2.2rem, 5vw, 3.2rem);
  align-items: start;
}
.footer-brand { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1rem; }
.footer-brand img {
  width: 52px; height: 52px; border-radius: 12px;
  background: #fff; padding: 5px; box-shadow: var(--shadow-sm);
}
.footer-brand span { font-family: "Sora", sans-serif; font-weight: 700; }
.footer-mission {
  font-style: italic;
  color: var(--text-muted);
  max-width: 46ch;
  border-left: 3px solid var(--brand-red);
  padding-left: 1rem;
}
.footer-meta { font-size: 0.9rem; color: var(--text-muted); }
.footer-meta .footer-title { font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.footer-meta p { margin: 0.25rem 0; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-block: 1.2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; gap: 1.6rem; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { max-width: 100%; }
  .brand__text { display: none; } /* garde l'en-tête compact sur mobile */
  .hero__eyebrow { font-size: 0.7rem; }
}

/* Respect de la préférence « réduire les animations » */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .card { opacity: 1; transform: none; }
}
