:root {
  --navy: #233a7d;
  --navy-deep: #1a2c5e;
  --orange: #f39321;
  --bg: #f7f8fc;
  --bg-card: #ffffff;
  --text: #1a1f3a;
  --text-soft: #5a6383;
  --text-muted: #8b93b0;
  --border: #e6e9f2;
  --radius: 14px;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.page-header {
  background: var(--navy);
  color: white;
  padding: 16px 0;
  position: relative;
}
.page-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), transparent);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
/* Hero */
.hero {
  padding: 40px 0 16px;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.15;
  max-width: 900px;
  margin-bottom: 12px;
}
.hero .lede {
  font-size: 16px;
  color: var(--text-soft);
  max-width: 720px;
}

/* Filtres */
.filters-section {
  padding: 16px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.filters-section .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--navy);
  color: var(--text);
}
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}
.reset-btn {
  margin-left: auto;
  font-size: 12px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
}
.reset-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Toolbar : toggle vue + bouton download */
.view-section {
  padding: 28px 0 48px;
}
.view-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.view-toggle-btn:hover {
  color: var(--text);
}
.view-toggle-btn.active {
  background: var(--navy);
  color: white;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: var(--navy-deep);
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(243, 147, 33, 0.2);
}
.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(243, 147, 33, 0.3);
}

/* Grid Carte + Calendrier */
.view-grid {
  display: grid;
  gap: 16px;
  min-height: 600px;
}
.view-grid.mode-split {
  grid-template-columns: 1fr 1fr;
}
.view-grid.mode-split .view-pane-minicalendar {
  display: none;
}
.view-grid.mode-timeline {
  grid-template-columns: 2fr 1fr;
}
.view-grid.mode-timeline .view-pane-map {
  display: none;
}
@media (max-width: 900px) {
  .view-grid.mode-split,
  .view-grid.mode-timeline {
    grid-template-columns: 1fr;
  }
}

.view-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Carte Leaflet */
.leaflet-map {
  width: 100%;
  height: 600px;
  border-radius: var(--radius);
}
.view-grid.mode-map .leaflet-map {
  height: 680px;
}
.leaflet-control-attribution {
  font-size: 10px !important;
}
.chemgtm-marker {
  background: var(--orange);
  border: 2px solid white;
  border-radius: 50%;
  width: 22px !important;
  height: 22px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  color: var(--navy-deep);
  font-weight: 700;
  font-size: 11px;
  font-family: "Inter", sans-serif;
  display: grid !important;
  place-items: center;
}
.chemgtm-marker:hover {
  transform: scale(1.2);
  z-index: 1000 !important;
}

/* Timeline */
.view-pane-timeline {
  padding: 16px;
  max-height: 632px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.view-grid.mode-timeline .view-pane-timeline {
  max-height: none;
  padding: 24px;
}
.timeline {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  flex: 1;
}
.view-grid.mode-split .timeline {
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: none;
  gap: 18px;
}
.tl-month {
  min-width: 240px;
  flex-shrink: 0;
  border-left: 2px solid var(--border);
  padding: 6px 14px;
  scroll-snap-align: start;
}
.view-grid.mode-split .tl-month {
  min-width: 0;
}
.tl-month .m-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tl-month .y-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.tl-event {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.tl-event:hover {
  border-color: var(--navy);
  transform: translateX(2px);
}
.tl-event .n {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tl-event .l {
  font-size: 11px;
  color: var(--text-soft);
}
.tl-event .d {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.tl-month.tl-month-highlight {
  background: linear-gradient(90deg, rgba(243, 147, 33, 0.08), transparent);
  border-left-color: var(--orange);
}

/* Mini-calendrier (mode "Calendrier") */
.view-pane-minicalendar {
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.mc-nav {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  display: grid;
  place-items: center;
  padding: 0;
}
.mc-nav:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.mc-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.mc-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.mc-weekdays span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mc-day {
  position: relative;
  aspect-ratio: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  font-family: inherit;
  cursor: default;
  display: grid;
  place-items: center;
  padding: 0;
}
.mc-day.empty {
  visibility: hidden;
}
.mc-day.outside {
  color: var(--text-muted);
  opacity: 0.4;
}
.mc-day.has-event {
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
}
.mc-day.has-event::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}
.mc-day.has-event:hover {
  background: #f0f3fc;
}
.mc-day.today {
  outline: 2px solid var(--navy);
  outline-offset: -2px;
}
.mc-hint {
  margin-top: auto;
  padding-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Panneau détail */
.event-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  padding: 56px 28px 28px;
}
.event-panel[aria-hidden="false"] {
  transform: translateX(0);
}
.ep-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  color: var(--text-soft);
  display: grid;
  place-items: center;
}
.ep-close:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.ep-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 58, 0.4);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ep-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.ep-section {
  margin-bottom: 20px;
}
.ep-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ep-section p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.ep-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}
.ep-place {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.ep-dates {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 24px;
}
.ep-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.ep-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  background: #f0f3fc;
  color: var(--navy);
  font-weight: 500;
}
.ep-cta {
  display: block;
  text-align: center;
  background: var(--navy);
  color: white !important;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 12px;
  transition: background 0.15s;
}
.ep-cta:hover {
  background: var(--navy-deep);
}
.ep-cta.secondary {
  background: transparent;
  color: var(--text-soft) !important;
  border: 1px solid var(--border);
}
.ep-multi-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: border-color 0.15s;
}
.ep-multi-item:hover {
  border-color: var(--navy);
}
.ep-multi-item .n {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.ep-multi-item .d {
  font-size: 12px;
  color: var(--text-soft);
}

/* Nav principale (alignée site) */
.primary-nav { display: flex; align-items: center; gap: 20px; font-size: 14px; font-weight: 500; }
.primary-nav a { color: rgba(255,255,255,0.85); text-decoration: none; transition: color .15s; }
.primary-nav a:hover { color: white; }
.primary-nav .nav-cta { background: var(--orange, #f39321); color: var(--navy-deep, #1a2c5e); padding: 9px 16px; border-radius: 8px; font-weight: 600; }
.primary-nav .nav-cta:hover { background: var(--orange-soft, #ffb547); }

/* Footer site (aligné site) */
.site-footer { border-top: 1px solid var(--border, #e6e9f2); padding: 36px 0; background: white; }
.site-footer .footer-inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; font-size: 13px; color: var(--text-soft, #5a6383); align-items: start; }
.footer-brand strong { display: block; color: var(--text, #1a1f3a); font-size: 14px; margin-bottom: 4px; }
.footer-tag { color: var(--text-muted, #8b93b0); font-size: 12px; }
.footer-contact { display: flex; flex-direction: column; gap: 4px; }
.footer-contact a { color: var(--text-soft, #5a6383); text-decoration: none; }
.footer-contact a:hover { color: var(--text, #1a1f3a); }
.site-footer .footer-meta { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.site-footer .footer-meta a { color: var(--text-soft, #5a6383); text-decoration: none; }
.site-footer .footer-meta a:hover { color: var(--text, #1a1f3a); }
.footer-powered { color: var(--text-muted, #8b93b0); font-size: 12px; }

@media (max-width: 700px) {
  .primary-nav { gap: 12px; font-size: 13px; }
  .primary-nav .nav-cta { padding: 7px 12px; }
  .site-footer .footer-inner { grid-template-columns: 1fr; gap: 16px; }
  .site-footer .footer-meta { align-items: flex-start; }
}
