@import "tailwindcss";

/* ========================================
   FIX DÉBORDEMENT GLOBAL - CRITIQUE
   ======================================== */
html {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ne pas restreindre les éléments fixes comme la navbar */
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* IMPORTANT : Ne pas mettre overflow-x: hidden sur main/section car ça casse position: sticky */
main, .container {
  max-width: 100vw;
}

/* ========================================
   APPLICATION GLOBAL
   ======================================== */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: #0f172a;
  background: #fff;
}

/* Boutons génériques (utilisés dans la home) */
.btn { display:inline-block; border-radius:999px; padding:.9rem 1.2rem; text-decoration:none; font-weight:800 }
.btn.primary { background:#fff; color:#7e5bef; box-shadow:0 10px 28px rgba(0,0,0,.08) }
.btn.secondary { background:transparent; border:2px solid #fff; color:#fff }

/* Container utilitaire (si besoin dans la home) */
.container { max-width:1140px; margin:0 auto; padding:0 24px; }

/* ========================================
   LEAFLET — POPUP "Déclic card"
   ======================================== */
.leaflet-container a { color:#7e5bef; text-decoration:none; }
.leaflet-container a:hover { text-decoration:underline; }

/* Configuration globale du popup Leaflet avec le bon sélecteur */
.leaflet-popup.dc-popup {
  max-width: none !important;
}

.leaflet-popup.dc-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15,23,42,.18);
  border: 1px solid #eef2f7;
}

.leaflet-popup.dc-popup .leaflet-popup-tip {
  display:none;
}

.leaflet-popup.dc-popup .dcpp {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  width: 100%;
}

.dcpp-img {
  width: 56px; height: 56px;
  border-radius: 12px;
  background:#f1f5f9 center/cover no-repeat;
  border:1px solid #e2e8f0;
  flex-shrink: 0;
}

.dcpp-head { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.dcpp-pill {
  font: 800 .72rem/1 "Epilogue", Inter, system-ui;
  letter-spacing:.02em;
  text-transform: uppercase;
  padding:.42rem .6rem;
  border-radius:999px;
  background:#f1f5f9;
  color:#0f172a;
  border:1px solid #e5e7eb;
}

.dcpp-title {
  font: 900 1rem/1.15 "Epilogue", Inter;
  margin: 0 0 4px 0;
  letter-spacing:-.01em;
  overflow-wrap: break-word;
  word-break: break-word;
}
.dcpp-org {
  font: 700 .9rem/1.3 "Inter";
  color:#475569;
  margin:0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.dcpp-addr {
  font: 500 .9rem/1.3 "Inter";
  color:#6b7280;
  margin:.2rem 0 .5rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.dcpp-blurb {
  font: 500 .9rem/1.35 "Inter";
  color: #334155;
  margin: .1rem 0 .5rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.dcpp-actions {
  display:flex; justify-content:flex-start; gap:8px; margin-top:.25rem;
}
.dcpp-actions a {
  display:inline-flex; align-items:center; gap:.4rem;
  font: 800 .9rem/1 "Epilogue"; text-decoration:none;
  background:#0ea5e9; color:#fff; padding:.6rem .8rem; border-radius:10px;
  transition: filter 0.2s ease;
}
.dcpp-actions a:hover { filter: brightness(0.95); }

/* Variantes de couleur selon catégorie */
.dcpp-pill[data-cat="benevolat"]    { background:#fff1f2; color:#be123c; border-color:#fecdd3; }
.dcpp-pill[data-cat="formation"]    { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.dcpp-pill[data-cat="rencontres"]   { background:#ecfdf5; color:#047857; border-color:#bbf7d0; }
.dcpp-pill[data-cat="entreprendre"] { background:#fff7ed; color:#c2410c; border-color:#fed7aa; }

/* ========================================
   LEAFLET — marqueurs colorés
   ======================================== */
.dc-marker {
  width:26px; height:26px; border-radius:9999px;
  border:2px solid #fff; display:grid; place-items:center;
  color:#fff; font-size:14px; box-shadow:0 1px 4px rgba(0,0,0,.25);
}

.dc-marker.benevolat    { background:#f43f5e; }
.dc-marker.ecologiser   { background:#16a34a; }
.dc-marker.formation    { background:#3b82f6; }
.dc-marker.rencontres   { background:#facc15; }
.dc-marker.entreprendre { background:#f59e0b; }
.dc-marker.histoires    { background:#a855f7; }
.dc-marker.default      { background:#7e5bef; }

/* Accessibilité : focus dans le popup */
.leaflet-popup.dc-popup .dcpp a:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ========================================
   RESPONSIVE — FIX POPUP MOBILE
   ======================================== */

/* Tablettes et écrans moyens */
@media (max-width: 768px) {
  .leaflet-popup.dc-popup .dcpp {
    grid-template-columns: 48px 1fr;
    gap: 10px;
    padding: 10px;
  }

  .dcpp-img {
    width: 48px;
    height: 48px;
  }

  .dcpp-title {
    font-size: 0.95rem;
  }

  .dcpp-org, .dcpp-addr, .dcpp-blurb {
    font-size: 0.85rem;
  }

  .dcpp-actions a {
    font-size: 0.85rem;
    padding: .55rem .7rem;
  }
}

/* Smartphones */
@media (max-width: 520px) {
  .leaflet-popup.dc-popup .leaflet-popup-content-wrapper {
    border-radius: 14px;
  }

  .leaflet-popup.dc-popup .dcpp {
    grid-template-columns: 44px 1fr;
    gap: 8px;
    padding: 10px;
  }

  .dcpp-img {
    width: 44px;
    height: 44px;
  }

  .dcpp-title {
    font-size: 0.9rem;
  }

  .dcpp-org, .dcpp-addr, .dcpp-blurb {
    font-size: 0.82rem;
  }

  .dcpp-pill {
    font-size: 0.68rem;
    padding: .35rem .5rem;
  }

  .dcpp-actions {
    flex-direction: column;
    gap: 6px;
  }

  .dcpp-actions a {
    width: 100%;
    justify-content: center;
    font-size: 0.82rem;
    padding: .5rem .6rem;
    min-height: 44px;
  }
}

/* Très petits écrans */
@media (max-width: 380px) {
  .leaflet-popup.dc-popup .dcpp {
    grid-template-columns: 40px 1fr;
    gap: 8px;
    padding: 8px;
  }

  .dcpp-img {
    width: 40px;
    height: 40px;
  }

  .dcpp-title {
    font-size: 0.85rem;
  }

  .dcpp-org, .dcpp-addr, .dcpp-blurb {
    font-size: 0.78rem;
  }
}

/* ========================================
   CTA ÉDITORIAL MARKDOWN
   ======================================== */
.markdown-content .md-cta{
  margin-top: 1rem;
  padding: 1rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(99,102,241,.18);
  background: rgba(99,102,241,.06);
}

.markdown-content .md-cta-title{
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.markdown-content .md-cta-title::before{
  content: "🚀";
  display: inline-flex;
}

.markdown-content blockquote,
.prose blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1rem 1rem 1.1rem;
  border-left: 4px solid rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.08);
  border-radius: 14px;
}

.markdown-content blockquote p,
.prose blockquote p {
  margin: 0 0 .5rem 0;
  font-weight: 700;
}

.markdown-content blockquote ul,
.prose blockquote ul {
  margin: .25rem 0 0 1rem;
}

/* ========================================
   DÉCLIC CARDS & CHIPS
   ======================================== */
.dc-card{
  background:#fff;
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 10px 30px rgba(2, 6, 23, .06);
}

.dc-chip{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  border-radius:999px;
  padding:.35rem .75rem;
  background: rgba(255,255,255,.9);
  border:1px solid rgba(15, 23, 42, .10);
  font-size:.875rem;
  font-weight:600;
  color: rgba(51,65,85,1);
}

.dc-map{
  height: 280px;
}

.dc-raise{
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.dc-raise:hover{
  transform: translateY(-2px);
  filter: saturate(1.02);
}

/* Markdown: un peu plus d'air */
.markdown-content h2{ margin-top: 1.8rem; margin-bottom: .6rem; }
.markdown-content h3{ margin-top: 1.2rem; margin-bottom: .4rem; }
.markdown-content p{ margin: .8rem 0; }

/* ========================================
   TÉMOIGNAGES PRO - STYLE SWAPN EXACT
   Photo grande en haut + texte en dessous
   ======================================== */

/* Header section témoignages */
.hm-testi-header {
  text-align: center;
  margin-bottom: 3rem;
}

.hm-testi-subtitle {
  font-size: 1.125rem;
  color: #6b7280;
  margin-top: 0.75rem;
  font-weight: 500;
}

/* Grille responsive des témoignages */
.hm-testimonials-pro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .hm-testimonials-pro {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* Carte témoignage - Style Swapn exact */
.hm-testi-card-pro {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: white;
  display: flex;
  flex-direction: column;
}

.hm-testi-card-pro:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Dégradé de fond selon couleur */
.testi-gradient {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;
}

/* Variantes de couleurs Swapn */
[data-color="violet"] .testi-gradient {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.15) 0%, #6366f1 60%);
}

[data-color="orange"] .testi-gradient {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.15) 0%, #f97316 60%);
}

[data-color="yellow"] .testi-gradient {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.15) 0%, #eab308 60%);
}

[data-color="beige"] .testi-gradient {
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.15) 0%, #d4a574 60%);
}

/* Contenu de la carte - Structure verticale comme Swapn */
.testi-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Zone photo - Format portrait rectangulaire pour utiliser l'espace */
.testi-photo-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem 1rem;
  flex-shrink: 0;
}

.testi-photo {
  width: 130px;
  height: 150px;
  border-radius: 20px;
  background-size: cover;
  background-position: center center;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  display: block;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* Bouton play adapté au format portrait */
.testi-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.testi-play:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: white;
}

.testi-play svg {
  margin-left: 4px;
  fill: #6366f1;
}

/* Bloc de texte - Partie basse compacte */
.testi-text-block {
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem 1.5rem;
  gap: 0.75rem;
  flex: 1;
}

/* Icône guillemets - Réduite */
.testi-quote-icon {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-bottom: 0;
}

/* Citation - Compacte */
.testi-quote {
  font-size: 1rem;
  line-height: 1.45;
  color: white;
  font-weight: 500;
  margin: 0;
  flex: 1;
}

/* Auteur - Compacte avec icône */
.testi-author {
  margin-top: auto;
  display: flex;
  align-items: start;
  gap: 0.5rem;
}

.testi-author::before {
  content: '';
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='rgba(255,255,255,0.6)' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 6c-2.475 0-4.5 2.025-4.5 4.5v6h6v-6h-3c0-1.65 1.35-3 3-3V6zm9 0c-2.475 0-4.5 2.025-4.5 4.5v6h6v-6h-3c0-1.65 1.35-3 3-3V6z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  margin-top: 0.1rem;
}

.testi-author-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.testi-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.testi-role {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.testi-location {
  display: none; /* Pas visible dans le style Swapn */
}

/* CTA finale */
.hm-testi-cta {
  text-align: center;
  padding-top: 1.5rem;
}

.hm-testi-btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: white;
  color: #7e5bef;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid #f1f5f9;
}

.hm-testi-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

/* Responsive mobile témoignages */
@media (max-width: 640px) {
  .hm-testi-header {
    margin-bottom: 2rem;
  }

  .testi-photo-wrapper {
    height: 160px;
    padding: 1.25rem 1rem 0.75rem;
  }

  .testi-photo {
    width: 110px;
    height: 130px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
  }

  .testi-play {
    width: 50px;
    height: 50px;
  }

  .testi-text-block {
    padding: 0 1.25rem 1.25rem;
    gap: 0.625rem;
  }

  .testi-quote-icon {
    width: 24px;
    height: 24px;
  }

  .testi-quote {
    font-size: 0.9375rem;
    line-height: 1.4;
  }

  .testi-author::before {
    width: 18px;
    height: 18px;
  }

  .testi-name {
    font-size: 0.875rem;
  }

  .testi-role {
    font-size: 0.75rem;
  }

  .hm-testi-btn {
    width: 100%;
    max-width: 320px;
  }
}

/* ========================================
   FIX LEAFLET POPUP Z-INDEX - MOBILE
   ======================================== */
.leaflet-pane {
  z-index: 400 !important;
}

.leaflet-popup-pane {
  z-index: 9999 !important;
}

.leaflet-popup {
  z-index: 9999 !important;
}

/* S'assurer que le popup est cliquable sur mobile */
@media (max-width: 768px) {
  .leaflet-popup {
    pointer-events: auto !important;
  }

  .leaflet-popup-content-wrapper,
  .leaflet-popup-content {
    pointer-events: auto !important;
  }

  /* FIX: Bouton de fermeture du popup cliquable */
  .leaflet-popup-close-button {
    z-index: 10001 !important;
    pointer-events: auto !important;
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 28px !important;
    line-height: 44px !important;
    text-align: center !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: white !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }

  .leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.8) !important;
  }
}

@media (max-width: 960px) {
  .hm-explore-grid {
    max-height: none;
  }
}
