:root {
  --ep-black: #0a0a0a;
  --ep-ink: #141414;
  --ep-muted: #5a6570;
  --ep-green: #1e8a60;
  --ep-green-bright: #61ce70;
  --ep-green-deep: #146b4a;
  --ep-mist: #eef4f0;
  --ep-line: rgba(30, 138, 96, 0.22);
  --ep-panel: #f7faf8;
  --ep-white: #fff;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ep-ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(30, 138, 96, 0.12), transparent 55%),
    linear-gradient(180deg, #f3f7f4 0%, #e8eee9 100%);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

a {
  color: var(--ep-green);
}

.ep-map-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.1rem 1.35rem 0.95rem;
  border-bottom: 1px solid var(--ep-line);
  background: linear-gradient(135deg, #0a0a0a 0%, #146b4a 78%, #1e8a60 100%);
  color: #fff;
}

.ep-map-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

.ep-map-brand span {
  color: var(--ep-green-bright);
}

.ep-map-sub {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  max-width: 42rem;
}

.ep-map-sub a {
  color: var(--ep-green-bright);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ep-map-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.ep-lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-width: min(420px, 92vw);
  justify-content: flex-end;
}

.ep-lang-btn {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  padding: 0.28rem 0.45rem;
  background: transparent;
}

.ep-lang-btn:hover,
.ep-lang-btn.is-active {
  color: #0a0a0a !important;
  background: var(--ep-green-bright);
  border-color: var(--ep-green-bright);
}

.ep-map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.ep-map-item__tag {
  background: var(--ep-green);
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  font-size: 0.65rem;
}

.ep-map-stat {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(97, 206, 112, 0.35);
  border-radius: 3px;
  padding: 0.45rem 0.7rem;
  min-width: 5.5rem;
}

.ep-map-stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ep-green-bright);
  line-height: 1.1;
}

.ep-map-stat small {
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  font-weight: 700;
}

.ep-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: center;
  padding: 0.65rem 1.25rem;
  background: var(--ep-panel);
  border-bottom: 1px solid var(--ep-line);
}

.ep-map-toolbar label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ep-muted);
}

.ep-map-toolbar select,
.ep-map-toolbar input[type="search"],
.ep-map-toolbar input[type="datetime-local"] {
  font: inherit;
  border: 1px solid var(--ep-line);
  background: #fff;
  border-radius: 3px;
  padding: 0.4rem 0.55rem;
  min-width: 9rem;
}

.ep-map-toolbar input[type="search"] {
  min-width: 14rem;
  flex: 1;
}

.ep-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0.2rem 0.45rem;
  border: 1px dashed var(--ep-line);
  border-radius: 4px;
  background: rgba(30, 138, 96, 0.05);
}

.ep-map-toolbar input[type="datetime-local"] {
  min-width: 11.5rem;
  max-width: 16rem;
}

.ep-period-clear {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--ep-line);
  background: #fff;
  color: var(--ep-green-deep);
  border-radius: 3px;
  padding: 0.38rem 0.65rem;
  cursor: pointer;
}

.ep-period-clear:hover {
  background: var(--ep-mist);
  border-color: var(--ep-green);
}

.ep-map-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  min-height: 0;
}

#ep-map {
  min-height: 420px;
  height: 100%;
  background: #d7e3db;
}

.ep-map-list-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--ep-line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
}

.ep-map-list-head {
  padding: 0.85rem 1rem 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid var(--ep-line);
}

.ep-map-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0 1rem;
  overflow: auto;
  flex: 1;
}

.ep-map-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(30, 138, 96, 0.12);
  cursor: pointer;
  transition: background 0.18s ease;
}

.ep-map-item:hover,
.ep-map-item.is-active {
  background: rgba(30, 138, 96, 0.1);
}

.ep-map-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 3px rgba(30, 138, 96, 0.15);
}

.ep-map-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ep-muted);
  margin-bottom: 0.25rem;
}

.ep-map-item__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
  margin: 0 0 0.25rem;
  color: var(--ep-black);
}

.ep-map-item__place {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ep-muted);
}

.ep-map-empty {
  padding: 1.5rem 1rem;
  color: var(--ep-muted);
}

.ep-map-foot {
  padding: 0.55rem 1.25rem;
  font-size: 0.75rem;
  color: var(--ep-muted);
  border-top: 1px solid var(--ep-line);
  background: var(--ep-panel);
}

/* Leaflet overrides */
.leaflet-container {
  font: inherit;
}

.ep-marker {
  background: transparent;
  border: 0;
}

.ep-marker__pulse {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(30, 138, 96, 0.45);
  animation: ep-pulse 2.2s ease-out infinite;
}

@keyframes ep-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 138, 96, 0.45);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(30, 138, 96, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(30, 138, 96, 0);
  }
}

.ep-popup .leaflet-popup-content-wrapper {
  border-radius: 4px;
  border-top: 3px solid var(--ep-green);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.ep-popup .leaflet-popup-content {
  margin: 0.85rem 1rem 1rem;
  min-width: 220px;
}

.ep-popup h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}

.ep-popup p {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: var(--ep-muted);
}

.ep-popup__badge {
  display: inline-block;
  background: var(--ep-black);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  margin-bottom: 0.45rem;
}

.ep-popup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.ep-popup__actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.45rem 0.7rem;
  border-radius: 3px;
}

.ep-btn-primary {
  background: var(--ep-green);
  color: #fff !important;
}

.ep-btn-primary:hover {
  background: var(--ep-green-deep);
}

.ep-btn-ghost {
  background: var(--ep-mist);
  color: var(--ep-ink) !important;
}

@media (max-width: 900px) {
  .ep-map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 45vh) minmax(0, 1fr);
  }

  .ep-map-list-wrap {
    border-left: 0;
    border-top: 1px solid var(--ep-line);
    max-height: 48vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ep-marker__pulse {
    animation: none;
  }
}

/* —— Abonnement alertes zonées —— */
.ep-sub-open,
.ep-install-open {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--ep-green);
  background: var(--ep-green);
  color: #fff;
  border-radius: 3px;
  padding: 0.42rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.ep-sub-open:hover {
  background: var(--ep-green-deep);
}

.ep-install-open {
  background: #fff;
  color: var(--ep-green-deep);
  border-color: var(--ep-green);
}

.ep-install-open:hover {
  background: var(--ep-mist);
}

.ep-install-howto {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ep-ink);
  margin: 0 0 1rem;
}

.ep-install-howto ol {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.ep-install-howto li {
  margin: 0.35rem 0;
}

.ep-sub-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  z-index: 9000;
}

.ep-sub-backdrop[hidden],
.ep-sub-panel[hidden] {
  display: none !important;
}

.ep-sub-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9001;
  width: min(420px, 92vw);
  max-height: min(90vh, 640px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--ep-line);
  border-radius: 6px;
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.ep-sub-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 1.5rem 0.5rem 0;
  color: var(--ep-ink);
}

.ep-sub-lead {
  font-size: 0.88rem;
  color: var(--ep-muted);
  line-height: 1.45;
  margin: 0 0 1rem;
}

.ep-sub-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ep-muted);
}

.ep-sub-form {
  display: grid;
  gap: 0.35rem 0.5rem;
}

.ep-sub-form label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ep-muted);
  margin-top: 0.35rem;
}

.ep-sub-form select,
.ep-sub-form input[type="text"],
.ep-sub-form input[type="email"] {
  font: inherit;
  border: 1px solid var(--ep-line);
  border-radius: 3px;
  padding: 0.45rem 0.55rem;
}

.ep-sub-check {
  display: flex !important;
  align-items: flex-start;
  gap: 0.5rem;
  text-transform: none !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--ep-ink) !important;
  letter-spacing: 0 !important;
  margin-top: 0.65rem !important;
}

.ep-sub-check input {
  margin-top: 0.2rem;
}

.ep-sub-submit {
  margin-top: 0.75rem;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 3px;
  padding: 0.65rem 1rem;
  background: var(--ep-green);
  color: #fff;
  cursor: pointer;
}

.ep-sub-submit:hover {
  background: var(--ep-green-deep);
}

.ep-sub-status {
  font-size: 0.86rem;
  min-height: 1.2em;
  margin: 0.35rem 0 0;
}

.ep-sub-status.is-ok {
  color: var(--ep-green-deep);
}

.ep-sub-status.is-err {
  color: #a33;
}

/* —— Google Ads slots —— */
.ep-ad {
  min-height: 0;
  text-align: center;
  overflow: hidden;
}

.ep-ad--top,
.ep-ad--footer {
  padding: 0.35rem 1rem;
  background: var(--ep-panel);
  border-bottom: 1px solid var(--ep-line);
}

.ep-ad--footer {
  border-bottom: 0;
  border-top: 1px solid var(--ep-line);
}

.ep-ad--sidebar {
  padding: 0.5rem;
  border-top: 1px solid var(--ep-line);
}

.ep-ad:empty {
  display: none;
}
