/* ============================================================
   CYCLE DE L'EAU – Orléans Métropole
   Infographie interactive
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --c-eau:          #005F7F;
  --c-eau-grad:     linear-gradient(135deg, #005F7F 0%, #0092BB 100%);
  --c-assain:       #8B4A13;
  --c-assain-grad:  linear-gradient(135deg, #7A3D0A 0%, #B05A1A 100%);
  --c-pulse-blue:   rgba(0, 146, 187, 0.75);
  --c-pulse-orange: rgba(176, 90, 26, 0.75);
  --radius-ctrl:    10px;
}

/* ── Reset minimal ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  overflow: hidden;
  background: #e0ddd6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Viewport de la carte ───────────────────────────────────── */
#map-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#map-viewport.is-dragging {
  cursor: grabbing;
}

/* ── Conteneur de la carte (transformé via JS) ─────────────── */
#map-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 3308px;
  height: 2339px;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#map-container.is-ready {
  opacity: 1;
}

/* ── Image SVG de la carte (vectorielle, nette à tout zoom) ──── */
#map-image {
  display: block;
  width: 3308px;
  height: 2339px;
  max-width: none;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════ */

#map-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #e0ddd6;
  z-index: 600;
  transition: opacity 0.45s ease;
}

#map-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.map-loading__spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.75rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: map-loading-spin 0.75s linear infinite;
}

.map-loading__text {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.875rem;
}

.map-loading__error {
  margin: 0;
  padding: 0 1rem;
  text-align: center;
  color: #b02a37;
  font-size: 0.875rem;
}

@keyframes map-loading-spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   POINTS CLIQUABLES
   ═══════════════════════════════════════════════════════════ */

.map-point {
  position: absolute;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  touch-action: none;
}

.map-point:focus {
  outline: none;
}

.map-point:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ── Anneau pulsant ─────────────────────────────────────────── */
.point-ring {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid;
  animation: ring-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.type-blue  .point-ring { border-color: var(--c-pulse-blue); }
.type-orange .point-ring { border-color: var(--c-pulse-orange); }

@keyframes ring-pulse {
  0%   { transform: scale(1.0); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* Décalage de phase pour que tous les points ne pulsent pas en même temps */
.map-point:nth-child(2) .point-ring { animation-delay: -0.4s; }
.map-point:nth-child(3) .point-ring { animation-delay: -0.8s; }
.map-point:nth-child(4) .point-ring { animation-delay: -1.2s; }
.map-point:nth-child(5) .point-ring { animation-delay: -1.6s; }
.map-point:nth-child(6) .point-ring { animation-delay: -2.0s; }
.map-point:nth-child(7) .point-ring { animation-delay: -0.2s; }
.map-point:nth-child(8) .point-ring { animation-delay: -1.0s; }

/* ── Halo sur survol / focus ────────────────────────────────── */
.map-point:hover .point-ring,
.map-point:focus-visible .point-ring {
  animation: none;
  transform: scale(1);
  opacity: 1;
}

.type-blue:hover  .point-ring,
.type-blue:focus-visible  .point-ring {
  box-shadow: 0 0 0 8px rgba(0, 146, 187, 0.25),
              0 0 16px 4px rgba(0, 146, 187, 0.35);
}

.type-orange:hover .point-ring,
.type-orange:focus-visible .point-ring {
  box-shadow: 0 0 0 8px rgba(176, 90, 26, 0.25),
              0 0 16px 4px rgba(176, 90, 26, 0.35);
}

/* ── Tooltip flottant ───────────────────────────────────────── */
.point-label {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 28, 40, 0.92);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transform-origin: center bottom;
}

.map-point:hover .point-label,
.map-point:focus-visible .point-label {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   CONTRÔLES (fixés en bas à droite)
   ═══════════════════════════════════════════════════════════ */

#map-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-ctrl);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 50, 75, 0.82);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover {
  background: rgba(0, 95, 127, 0.95);
}

.ctrl-btn:active {
  transform: scale(0.92);
}

.ctrl-btn--reset {
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════
   HINT (disparaît au premier geste)
   ═══════════════════════════════════════════════════════════ */

#map-hint {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 28, 40, 0.78);
  color: rgba(255, 255, 255, 0.92);
  padding: 0.45rem 1.1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  z-index: 150;
  pointer-events: none;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}

#map-hint.is-hidden {
  opacity: 0;
}

.map-hint__text {
  margin-left: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   MODALES – image bloc
   ═══════════════════════════════════════════════════════════ */

/* ── Animation d'entrée / sortie ────────────────────────────── */
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.88) translateY(24px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

@keyframes modal-out {
  from { opacity: 1; transform: scale(1)    translateY(0);    }
  to   { opacity: 0; transform: scale(0.92) translateY(32px); }
}

.bloc-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.bloc-modal[hidden] {
  display: none;
}

.bloc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.bloc-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(580px, 95vw);
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: modal-in 0.32s cubic-bezier(0.34, 1.48, 0.64, 1) both;
}

.bloc-modal.is-closing .bloc-modal__panel {
  animation: modal-out 0.22s ease-in both;
}

/* Largeur adaptée au ratio paysage des blocs */
.modal-bloc {
  max-width: min(580px, 95vw);
}

/* L'image remplit la modale */
.bloc-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Bouton fermer flottant */
.btn-close-bloc {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #333;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.15s;
}

.btn-close-bloc:hover {
  background: #fff;
  transform: scale(1.1);
}


/* ═══════════════════════════════════════════════════════════
   TUTORIAL – popup d'onboarding
   ═══════════════════════════════════════════════════════════ */

#map-tutorial {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4rem;
  z-index: 500;
  pointer-events: none;
}

#tutorial-card {
  pointer-events: auto;
  background: rgba(8, 22, 34, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 1.25rem 1.5rem 0;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
  transform: translateY(24px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34,1.2,0.64,1), opacity 0.35s ease;
  overflow: hidden;
  cursor: pointer;
}

#map-tutorial.is-visible #tutorial-card {
  transform: translateY(0);
  opacity: 1;
}

.tutorial-title {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.tutorial-tips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tutorial-tip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 1.1rem;
  text-align: center;
  color: rgba(255,255,255,0.88);
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 500;
}

.tutorial-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4fc3e8;
}

.tutorial-icon svg {
  width: 100%;
  height: 100%;
}

.tutorial-sep {
  width: 1px;
  height: 48px;
  background: rgba(255,255,255,0.12);
  flex-shrink: 0;
}

/* Barre de progression qui se vide en 5 s */
.tutorial-bar {
  margin: 0 -1.5rem;
  height: 3px;
  background: rgba(255,255,255,0.08);
}

.tutorial-bar-fill {
  height: 100%;
  background: rgba(79, 195, 232, 0.6);
  width: 100%;
}

#map-tutorial.is-visible .tutorial-bar-fill {
  animation: tutorial-drain 5s linear forwards;
}

@keyframes tutorial-drain {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE – mobile
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 576px) {
  #map-hint {
    font-size: 0.72rem;
    padding: 0.4rem 0.85rem;
    white-space: normal;
    text-align: center;
    max-width: 90vw;
  }

  .ctrl-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  #map-controls {
    bottom: 1rem;
    right: 0.5rem;
    gap: 5px;
  }

  .info-highlight__number {
    font-size: 1.3rem;
  }
}
