/* Cadre le hero principal de la page d'accueil. */
.hero {
  padding: 46px 0 32px;
  text-align: center;
  color: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Dimensionne le titre principal du hero. */
.hero h1 {
  margin: 12px 0 0;
  /* Le clamp garde un titre lisible du mobile au large ecran. */
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: 0.5px;
}

/* Regle les paragraphes standards du hero. */
.hero p {
  margin: 18px auto 22px;
  max-width: 70ch;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.55;
  font-size: 14px;
}

/* Met en avant la consigne centrale avec un degrade. */
.hero-consigne {
  font-size: 1.6rem !important;
  font-weight: 700;
  background: linear-gradient(135deg, #ffb84d, #ff7a59);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 25px auto 30px !important;
  max-width: 70ch;
  line-height: 1.6;
}

/* Aligne les boutons principaux sous le hero. */
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Place le robot decoratif sur desktop. */
.hero-assistant {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  pointer-events: none;
  animation: heroFloat 3.2s ease-in-out infinite;
}

/* Donne une taille stable au robot. */
.hero-robot {
  width: 200px;
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.35));
}

/* Positionne la bulle d'aide a cote du robot. */
.hero-bubble {
  position: absolute;
  right: -95px;
  top: -65px;
  width: 170px;
  height: auto;
  opacity: 0;
  transform: translateX(10px) scale(0.98);
  transition: opacity 0.45s ease, transform 0.45s ease;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.32));
}

/* Revele la bulle quand la classe d'etat est activee. */
.hero-assistant.is-bubble-on .hero-bubble {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* Cree la legere oscillation du robot. */
@keyframes heroFloat {
  0%, 100% { transform: translateY(-50%) translateY(0); }
  50% { transform: translateY(-50%) translateY(-10px); }
}

/* Cadre la zone du globe et de l'animation volante. */
.globe-stage {
  position: relative;
  /* Le min conserve une scene large sans depasser l'ecran. */
  width: min(1100px, 96vw);
  height: 260px;
  margin: 8px auto 0;
  display: grid;
  place-items: center;
  transform: translateX(-20px);
}

/* Dimensionne l'image du globe. */
.globe-img {
  width: min(980px, 96vw);
  height: auto;
  user-select: none;
  pointer-events: none;
}

/* Prepare le sprite volant pour l'animation JS. */
.flyer {
  position: absolute;
  top: 72px;
  left: 50%;
  width: 130px;
  height: auto;
  transform: translateX(-50%);
  opacity: 0;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.20));
  pointer-events: none;
  will-change: transform, opacity;
}

/* Reserve la zone des points interactifs au-dessus du globe. */
.pins-stage {
  position: relative;
  width: min(1100px, 96vw);
  height: 0;
  margin: 0 auto;
}

/* Sert de point d'ancrage a chaque region. */
.pin-wrapper {
  position: absolute;
  z-index: 10;
}

/* Place le repere Alaska sur le globe. */
.pin-wrapper.alaska {
  left: 29%;
  top: -170px;
}

/* Place le repere Amazonie sur le globe. */
.pin-wrapper.amazon {
  left: 39%;
  top: -30px;
}

/* Place le repere Sahara sur le globe. */
.pin-wrapper.sahara {
  left: 50%;
  top: -115px;
}

/* Stylise le bouton repere de carte. */
.pin {
  position: relative;
  width: 48px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s ease;
  animation: pin-float 3s ease-in-out infinite;
}

/* Souleve legerement le repere au survol. */
.pin:hover {
  transform: translateY(-8px);
}

/* Rend le focus clavier visible. */
.pin:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 5px;
}

/* Anime le flottement vertical des reperes. */
@keyframes pin-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Dessine la goutte du repere. */
.pin .drop {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 18px 18px 18px 0;
  transform: rotate(-45deg);
  background: var(--pin);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
  position: relative;
  animation: pin-pulse-simple 2.5s ease-in-out infinite;
}

/* Pulse la goutte pour attirer l'oeil. */
@keyframes pin-pulse-simple {
  0%, 100% {
    transform: rotate(-45deg) scale(1);
  }
  50% {
    transform: rotate(-45deg) scale(1.15);
  }
}

/* Dessine le point central du repere. */
.pin .drop::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--pinAccent);
  top: 10px;
  left: 10px;
  transform: rotate(45deg);
  animation: dot-pulse-simple 2.5s ease-in-out infinite;
}

/* Pulse le coeur du repere en meme temps que la goutte. */
@keyframes dot-pulse-simple {
  0%, 100% {
    transform: rotate(45deg) scale(1);
    opacity: 1;
  }
  50% {
    transform: rotate(45deg) scale(1.3);
    opacity: 0.7;
  }
}

/* Affiche le libelle de region sous le repere. */
.pin-label {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #fff;
  background: rgba(11, 34, 48, 0.9);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 176, 32, 0.5);
  margin-top: 8px;
  text-align: center;
  transition: all 0.3s ease;
  display: block;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
}

/* Accentue le libelle quand la region est survolee. */
.pin:hover .pin-label {
  background: linear-gradient(135deg, #ff7a59, #ffb020);
  border-color: #ffb020;
  transform: translateY(-3px);
}

/* Contient la carte detaillee d'une region. */
.pin-card {
  position: absolute;
  left: 50%;
  bottom: 56px;
  transform: translate(-50%, 10px);
  width: 300px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
}

/* Dessine la petite fleche de la carte. */
.pin-card::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid rgba(255, 255, 255, 0.98);
}

/* Ouvre la carte au survol du repere. */
.pin:hover .pin-card,
.pin-wrapper:hover .pin-card {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: all;
}

/* Cadre l'image d'aperçu de la carte. */
.pin-card-preview {
  width: 100%;
  height: 160px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #e8f4f8, #d0e8f0);
}

/* Ajuste l'image d'aperçu dans son cadre. */
.pin-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* Ajoute un zoom doux sur l'aperçu au survol. */
.pin-wrapper:hover .pin-card-preview img,
.pin:hover .pin-card-preview img {
  transform: scale(1.05);
}

/* Pose un voile de contraste sur l'aperçu. */
.pin-card-preview::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

/* Structure le contenu textuel de la carte. */
.pin-card-content {
  padding: 16px 20px 20px;
}

/* Stylise le titre de la carte de region. */
.pin-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px 0;
}

/* Regle le texte descriptif de la carte. */
.pin-card p {
  font-size: 0.9rem;
  color: rgba(11, 34, 48, 0.7);
  line-height: 1.5;
  margin: 0 0 15px 0;
}

/* Transforme le lien d'action en bouton plein format. */
.pin-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #ff7a59, #ffb020);
  color: #fff;
  text-align: center;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 122, 89, 0.4);
  text-transform: uppercase;
}

/* Accentue le bouton d'action au survol. */
.pin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 122, 89, 0.6);
}

/* Donne une couleur signature a chaque region. */
.pin-wrapper.alaska .pin-card {
  border-top: 4px solid #7CA5B8;
}

.pin-wrapper.amazon .pin-card {
  border-top: 4px solid #4A7C59;
}

.pin-wrapper.sahara .pin-card {
  border-top: 4px solid #E8A87C;
}

/* Repositionne le robot sur les tailles intermediaires. */
@media (max-width: 900px) {
  .hero-assistant {
    position: static;
    transform: none;
    margin-top: 18px;
    width: 220px;
    animation: heroFloatMobile 3.2s ease-in-out infinite;
  }
  
  /* Rejoue l'oscillation du robot en version mobile. */
  @keyframes heroFloatMobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
  
  .hero-bubble {
    right: -90px;
  }
}

/* Compacte le globe et les cartes sur tablette. */
@media (max-width: 820px) {
  .globe-stage {
    height: 210px;
  }
  
  .flyer {
    width: 105px;
    top: 60px;
  }
  
  .pin-card {
    width: 260px;
  }
}
