:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --bg: #fafafa;
  --accent: #c0392b;
  --confirmed: #c0392b;
  --suspected: #e67e22;
  --unconfirmed: #f1c40f;
  --monitored: #3498db;
  --transport: #9b59b6;
  --no-ebola: #27ae60;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

.lem-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.lem-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.lem-brand img {
  height: 44px;
  width: auto;
  display: block;
}

.lem-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.lem-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 4px;
}

.lem-nav a:hover { color: var(--accent); }

/* Donate button: pill styling lives on the inner <span> so the outer <a>
   can become a full-width centered row on mobile without stretching the pill. */
.donate-btn {
  text-decoration: none;
  display: inline-block;
}
.donate-btn > span {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.donate-btn:hover > span { background: #962d22; }

@keyframes lem-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}
.donate-btn.pulse > span { animation: lem-pulse 2.4s ease-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .donate-btn.pulse > span { animation: none; }
}

/* Donate modal */
.donate-modal[hidden] { display: none !important; }
.donate-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.donate-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  cursor: pointer;
}
.donate-modal-content {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 28px 24px 22px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.donate-modal-content h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.donate-modal-content .muted { font-size: 13px; }
.donate-close {
  position: absolute;
  top: 8px; right: 12px;
  background: none; border: 0;
  font-size: 24px; line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.donate-close:hover { color: var(--ink); }
.donate-method-label {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.donate-qr {
  margin: 12px auto 10px;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
}
.donate-qr canvas { border-radius: 4px; }
.donate-addr-row {
  display: flex; gap: 6px;
  align-items: stretch;
  margin: 8px 0 4px;
}
.donate-addr-row code {
  flex: 1;
  background: #f5f5f5;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.copy-btn {
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover { background: var(--accent); }
.donate-foot { margin-bottom: 0; }

.lem-stats {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.lem-stats-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat {
  text-align: center;
  padding: 10px;
}

.stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 4px;
}

.stat-num.stat-deaths { color: #000; }

.stats-source {
  margin: 0 auto;
  padding: 0 20px 14px;
  max-width: 1400px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.stats-source a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
}
.stats-source a:hover { color: var(--accent); }

.lem-legend {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Unicode icons used in the legend, stats header, and as Leaflet div markers */
.lem-icon {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  display: inline-block;
}
.icon-confirmed   { color: #c0392b; } /* red */
.icon-suspected   { color: #f1c40f; } /* yellow */
.icon-unconfirmed { color: #e67e22; } /* orange */
.icon-monitored   { color: #27ae60; } /* green */
.icon-transport   { color: #3498db; } /* blue */
.icon-no-ebola    { color: #27ae60; } /* green */
.icon-deaths      { color: #1a1a1a; } /* black */

/* Inside .stat the icon inherits the big number size */
.stat .lem-icon { font-size: inherit; vertical-align: -2px; }

/* Leaflet div-icon wrappers: strip default white box + border */
.lem-map-divicon { background: transparent; border: none; }
.map-marker-icon {
  display: block;
  text-align: center;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  /* White outline so symbols stay readable on any map tile */
  text-shadow:
    -1px -1px 0 #fff,
     1px -1px 0 #fff,
    -1px  1px 0 #fff,
     1px  1px 0 #fff,
     0 0 4px rgba(0, 0, 0, 0.45);
}

/* Case-count glow: a status-colored halo whose size and opacity scale with the
   location's case count (set via --r and --go in app.js). Overlapping halos in
   hard-hit areas blend into a soft heat/spread effect. */
.lem-marker { position: relative; width: 36px; height: 36px; }
.lem-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--r, 40px);
  height: var(--r, 40px);
  margin-top: calc(var(--r, 40px) / -2);
  margin-left: calc(var(--r, 40px) / -2);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow, #c0392b), transparent 72%);
  opacity: var(--go, 0.4);
  pointer-events: none;
}
/* keep the glyph painted above its halo */
.lem-marker .map-marker-icon { position: relative; }

.lem-map-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

#map-canvas {
  width: 100%;
  height: 600px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.lem-table-wrap, .lem-submit-wrap, .lem-about, .lem-comments {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px;
}

h2 {
  margin-top: 0;
  font-size: 22px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
  display: inline-block;
}

.muted { color: var(--muted); font-size: 14px; }

#submit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 760px;
  margin-top: 16px;
}

#submit-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 4px;
}

#submit-form label.full { grid-column: 1 / -1; }

#submit-form input,
#submit-form select,
#submit-form textarea {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

#submit-form button {
  grid-column: 1 / -1;
  justify-self: start;
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 22px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

#submit-form button:hover { background: #962d22; }

.form-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
}

.form-status.ok { color: var(--no-ebola); }
.form-status.err { color: var(--accent); }

.lem-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 24px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.leaflet-popup-content { font-size: 13px; line-height: 1.4; }
.leaflet-popup-content strong { display: block; margin-bottom: 4px; }
.leaflet-popup-content a { color: var(--accent); }

/* DataTables — overrides for the cases table */
#cases-table {
  width: 100% !important;
  border-collapse: collapse;
  font-size: 14px;
}

#cases-table thead th {
  background: #f5f5f5;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--accent);
  white-space: nowrap;
}

#cases-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

#cases-table tbody tr:hover { background: #fafafa; }

#cases-table tbody td:nth-child(1) { white-space: nowrap; width: 110px; color: var(--muted); }
#cases-table tbody td:nth-child(2) { width: 110px; font-weight: 600; }
#cases-table tbody td:nth-child(3) { width: 200px; }
#cases-table tbody td:nth-child(5) { width: 70px; }

.dataTables_wrapper {
  margin-top: 16px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter { float: right; }

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  margin: 0 4px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.dataTables_wrapper .dataTables_info { float: left; }
.dataTables_wrapper .dataTables_paginate { float: right; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 4px 10px;
  margin: 0 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
  color: var(--ink) !important;
  text-decoration: none;
  display: inline-block;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dataTables_wrapper::after {
  content: "";
  display: table;
  clear: both;
}

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .lem-header-inner {
    padding: 10px 14px;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .lem-brand img { height: 38px; }
  .lem-nav {
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .lem-nav a { font-size: 13px; }
  /* Mobile: donate gets its own centered row */
  .donate-btn {
    flex-basis: 100%;
    text-align: center;
    margin-top: 4px;
  }
  .donate-btn > span {
    padding: 8px 24px;
  }

  .lem-stats-inner {
    padding: 14px 12px;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    justify-items: center;
  }
  /* If the last stat is alone on its row (odd count), span both columns. */
  .lem-stats-inner .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 6px 4px; text-align: center; }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 10px; letter-spacing: 0.04em; }

  .lem-legend {
    padding: 12px;
    gap: 10px 14px;
    font-size: 12px;
    justify-content: flex-start;
  }
  .legend-item .lem-icon { font-size: 18px; }

  .lem-map-wrap,
  .lem-table-wrap,
  .lem-submit-wrap,
  .lem-about,
  .lem-comments {
    padding-left: 12px;
    padding-right: 12px;
  }
  .lem-map-wrap { padding-bottom: 16px; }

  #map-canvas {
    height: 380px;
    border-radius: 4px;
  }

  h2 { font-size: 18px; }

  /* Cases table on mobile: drop the Description column so the table fits naturally.
     Description is still available by tapping the marker on the map. */
  .dataTables_wrapper { width: 100%; max-width: 100%; }
  #cases-table { font-size: 12px; width: 100% !important; }
  #cases-table thead th:nth-child(4),
  #cases-table tbody td:nth-child(4) { display: none; }
  #cases-table tbody td:nth-child(1) { width: auto; }
  #cases-table tbody td:nth-child(2) { width: auto; }
  #cases-table tbody td:nth-child(3) { width: auto; word-break: break-word; }
  #cases-table thead th,
  #cases-table tbody td { padding: 8px 6px; }

  /* DataTables controls: stack and full-width on mobile */
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: left;
    margin: 8px 0;
  }
  .dataTables_wrapper .dataTables_filter input { width: 100%; }
  .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Form: full-width inputs, full-width submit */
  #submit-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #submit-form input,
  #submit-form select,
  #submit-form textarea {
    padding: 10px 12px;
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
  }
  #submit-form button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
  }

  /* Leaflet popups: comfortable on touch */
  .leaflet-popup-content { font-size: 14px; min-width: 200px; }
}

/* ===== Very small (iPhone SE, 320px) ===== */
@media (max-width: 380px) {
  .lem-stats-inner { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 18px; }
  #map-canvas { height: 340px; }
  .lem-nav { gap: 10px; }
  .lem-nav a { font-size: 12px; }
}

/* Screen-reader / SEO heading: present for assistive tech and search engines,
   visually hidden because the logo already shows the brand. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Honeypot: kept in the DOM for bots but removed from view and the a11y tree. */
.lem-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Shared button */
.lem-btn {
  display: inline-block;
  background: var(--accent, #c0392b);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.lem-btn:hover { opacity: 0.9; }
.lem-btn-ghost {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(128, 128, 128, 0.5);
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 14px 20px;
  background: #1b1b1b;
  color: #f0f0f0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}
.cookie-banner .cookie-text { margin: 0; max-width: 720px; font-size: 14px; line-height: 1.5; }
.cookie-banner a { color: #ff8a7a; }
.cookie-actions { display: flex; gap: 10px; }
/* display:flex above would override the [hidden] attribute; restore it so the
   banner actually hides when dismissed (and stays hidden for non-EU visitors). */
.cookie-banner[hidden] { display: none; }

/* Comments gate (shown when comment cookies aren't accepted) */
.comments-gate {
  border: 1px dashed rgba(128, 128, 128, 0.5);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}
.comments-gate p { margin: 0 0 12px; }

/* Legal pages */
.lem-legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 56px;
  line-height: 1.6;
}
.lem-legal h1 { margin-bottom: 4px; }
.lem-legal h2 { margin-top: 28px; }
.lem-legal ul { padding-left: 22px; }
.lem-legal li { margin-bottom: 8px; }

.lem-footer-links { margin-top: 8px; font-size: 13px; }
