/* ============================================================
   VARIABLES — modifier ces valeurs pour adapter au logo
   ============================================================ */
:root {
  /* Couleurs principales */
  --color-primary:        #01254d;
  --color-primary-dark:   #01254d;
  --color-primary-light:  #1a4da8;
  --color-accent:         #f09401;
  --color-accent-dark:    #f09401;

  /* Arrière-plans */
  --color-bg:             #f8f9fa;
  --color-bg-alt:         #eef2f7;
  --color-white:          #ffffff;

  /* Texte */
  --color-text:           #1a1a2e;
  --color-text-light:     #5a6478;

  /* Carte interactive */
  --color-dept:           #dce8f5;
  --color-dept-stroke:    #b0c8e8;
  --color-dept-active:    #4a90d9;

  /* Typographie */
  --font-sans:            'Poppins', system-ui, -apple-system, sans-serif;

  /* Espacements */
  --sp-xs:   0.5rem;
  --sp-sm:   1rem;
  --sp-md:   1.5rem;
  --sp-lg:   4rem;
  --sp-xl:   6rem;

  /* Coins arrondis */
  --r-sm:    4px;
  --r-md:    8px;
  --r-lg:    16px;

  /* Ombres */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.16);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans), serif;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  border-radius: var(--r-sm);
}

.logo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 var(--sp-sm);
  background: rgba(255,255,255,0.15);
  border-radius: var(--r-sm);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  border: 2px solid rgba(255,255,255,0.3);
}

/* Réseaux sociaux */
.social-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.social-cta {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  padding-right: 0.75rem;
  border-right: 1px solid rgba(255,255,255,0.2);
  margin-right: 0.15rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ============================================================
   HERO BANNER
   ============================================================ */
.hero-banner {
  position: relative;
  min-height: 480px;
  background-image: url('assets/hero.jpg');
  background-size: cover;
  background-position: center;
  background-color: var(--color-primary-dark);
  display: flex;
  align-items: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(1, 37, 77, 0.82) 0%,
    rgba(1, 37, 77, 0.58) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-md);
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-sm);
}

.hero-title {
  font-size: clamp(1.85rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  color: white;
  margin-bottom: var(--sp-md);
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--r-md);
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.hero-cta:hover {
  background: white;
  transform: translateY(-2px);
}

.hero-cta svg {
  transition: transform 0.2s;
}

.hero-cta:hover svg { transform: translateX(4px); }

/* ============================================================
   SECTION PRÉSENTATION
   ============================================================ */
#presentation {
  background: var(--color-white);
  padding: var(--sp-xl) 0;
}

.presentation-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
  text-align: center;
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  margin-bottom: var(--sp-sm);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary-dark);
  margin-bottom: var(--sp-md);
}

.section-title .highlight { color: var(--color-accent-dark); }

.presentation-text {
  font-size: 1.05rem;
  color: var(--color-text-light);
  margin-bottom: var(--sp-sm);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.presentation-stats {
  display: flex;
  justify-content: center;
  gap: var(--sp-lg);
  margin-top: var(--sp-lg);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--color-bg-alt);
}

.stat { text-align: center; }

.stat-value {
  text-wrap: nowrap;
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--color-text-light);
  margin-top: 0.2rem;
}

/* ============================================================
   SECTION CARTE
   ============================================================ */
#map-section {
  background: var(--color-bg-alt);
  padding: var(--sp-xl) 0;
}

.map-section-header {
  text-align: center;
  margin-bottom: var(--sp-lg);
  padding: 0 var(--sp-md);
}

.map-hint {
  font-size: 0.88rem;
  color: var(--color-text-light);
  margin-top: var(--sp-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.map-hint::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--color-accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.map-wrapper {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

#map-container {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--color-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

#france-map {
  display: block;
  width: 100%;
  height: auto;
}

/* Départements SVG */
.dept-path {
  fill: var(--color-dept);
  stroke: var(--color-dept-stroke);
  stroke-width: 0.5;
  transition: fill 0.2s ease;
  pointer-events: none;
}

.dept-path.dept-hover {
  fill: #b8d4ee;
  stroke: #8ab2d6;
  stroke-width: 0.6;
}

.dept-path.dept-highlighted {
  fill: var(--color-dept-active);
  stroke: #2a6db5;
  stroke-width: 0.8;
}

.dept-path.dept-highlighted.dept-hover {
  fill: #2e75c4;
  stroke: #1a55a0;
  stroke-width: 1;
}

/* Points agences */
.agency-point {
  fill: var(--color-accent);
  stroke: white;
  stroke-width: 2.5;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  transition: fill 0.15s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.agency-point:hover,
.agency-point.active {
  fill: var(--color-primary);
}

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

/* Anneaux pulsants */
.pulse-ring {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.5;
  pointer-events: none;
  transform-origin: center;
  transform-box: fill-box;
  animation: pulse-expand 2.5s ease-out infinite;
}

@keyframes pulse-expand {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0;   }
}

/* ============================================================
   PANNEAU AGENCE
   ============================================================ */
.agency-panel {
  flex: 0 0 288px;
  background: var(--color-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 645px; /* fallback — overridden by JS ResizeObserver */
}

/* Placeholder (aucune agence sélectionnée) */
.panel-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  text-align: center;
}

.placeholder-icon {
  width: 52px;
  height: 52px;
  background: var(--color-dept);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.placeholder-icon svg {
  width: 26px;
  height: 26px;
  fill: var(--color-dept-active);
}

.placeholder-text {
  font-size: 0.88rem;
  color: var(--color-text-light);
  line-height: 1.6;
}

/* Contenu agence */
.panel-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-content[hidden] { display: none; }

.panel-header {
  padding: var(--sp-md) var(--sp-md) var(--sp-sm);
  flex-shrink: 0;
}

.panel-scrollable-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-scrollable-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.panel-scrollable-wrap.at-end::after {
  opacity: 0;
}

.panel-scrollable {
  height: 100%;
  overflow-y: auto;
  padding: 0 var(--sp-md) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.panel-footer {
  padding: var(--sp-sm) var(--sp-md) var(--sp-md);
  flex-shrink: 0;
  border-top: 1px solid var(--color-bg-alt);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: var(--sp-sm);
}

.panel-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--color-bg-alt);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.panel-close:hover {
  background: var(--color-primary);
  color: white;
}

.panel-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  background: rgba(232,184,75,0.15);
  padding: 0.25em 0.65em;
  border-radius: var(--r-sm);
  width: fit-content;
}

.panel-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.3;
}

.panel-description {
  font-size: 0.88rem;
  color: var(--color-text-light);
  line-height: 1.65;
}

.panel-divider {
  height: 1px;
  background: var(--color-bg-alt);
  border: none;
}

.panel-dept-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 0.65rem;
}

.panel-dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dept-tag {
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-dept);
  color: var(--color-primary);
  padding: 0.25em 0.6em;
  border-radius: var(--r-sm);
  border: 1px solid var(--color-dept-stroke);
  white-space: nowrap;
}

.btn-visit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--r-md);
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-visit:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn-visit svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.btn-visit:hover svg { transform: translateX(4px); }

/* ============================================================
   ÉTAT DE CHARGEMENT
   ============================================================ */
.map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--color-text-light);
  font-size: 0.9rem;
  gap: 0.75rem;
  flex-direction: column;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-dept-stroke);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.map-error { color: #c0392b; }

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

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.65);
  padding: var(--sp-md) 0;
  text-align: center;
  font-size: 0.84rem;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.map-tooltip {
  position: fixed;
  background: var(--color-primary-dark);
  color: white;
  font-family: var(--font-sans), serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3em 0.7em;
  border-radius: var(--r-md);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  transform: translate(-50%, calc(-100% - 12px));
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.map-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-primary-dark);
}

.map-tooltip.visible {
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header-inner {
    height: 60px;
    padding: 0 var(--sp-sm);
  }

  .logo-img,
  .logo-fallback {
    height: 40px;
    font-size: 0.95rem;
  }

  .social-cta { display: none; }

  .social-link {
    width: 38px;
    height: 38px;
  }

  .social-link svg {
    width: 17px;
    height: 17px;
  }

  .hero-banner { min-height: 340px; }

  .presentation-stats {
    gap: var(--sp-md);
    flex-wrap: wrap;
  }

  .stat { flex: 1 1 calc(50% - var(--sp-md)); }

  /* Panneau passe sous la carte sur mobile */
  .map-wrapper {
    flex-direction: column;
    gap: var(--sp-sm);
  }

  .agency-panel {
    flex: none;
    width: 100%;
    min-height: 160px;
  }
}

@media (max-width: 480px) {
  #presentation,
  #map-section {
    padding: var(--sp-lg) 0;
  }

  .map-wrapper { padding: 0 var(--sp-sm); }
}
