/*
 * eliot-stats.css — scoped styles for the portable "Eliot variant" of the
 * town-statistics modal (window.eliotStats). Every selector is namespaced under
 * .es- so it cannot collide with a host viewer's own CSS (Richmond/IF use
 * different class systems). Self-contained dark-glass palette matching Eliot
 * (no dependency on the host page defining --bg/--brand/etc.).
 */

.es-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9500;                 /* above the viewer chrome, below any lightbox */
  background: rgba(6, 11, 20, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  font-family: var(--font, Charter, "Bitstream Charter", Cambria, "Palatino Linotype", Georgia, serif);
}
.es-modal-bg.is-open { display: flex; }

.es-modal {
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(22, 32, 45, 0.96), rgba(13, 20, 33, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.30);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  color: #e7ecf3;
  overflow: hidden;
}

.es-modal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(201, 169, 98, 0.06);
}
.es-modal-h h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #e7ecf3;
}
.es-close {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(148, 163, 184, 0.10);
  color: #cbd5e1;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.es-close:hover {
  background: rgba(201, 169, 98, 0.16);
  border-color: rgba(201, 169, 98, 0.40);
  color: #e7ecf3;
}

.es-modal-body {
  padding: 18px;
  overflow-y: auto;
}

/* Headline stat cards */
.es-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.es-stat {
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 12px 14px;
}
.es-stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9aa6b6;
  margin-bottom: 5px;
}
.es-stat .val {
  font-size: 20px;
  font-weight: 800;
  color: #e7ecf3;
  font-variant-numeric: tabular-nums;
}

/* Detail sections */
.es-section { margin-top: 18px; }
.es-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #c9a962;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.es-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 720px) { .es-2col { grid-template-columns: 1fr; } }

.es-modal-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.es-modal-body th,
.es-modal-body td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.es-modal-body th {
  color: #9aa6b6;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.es-modal-body td.num,
.es-modal-body th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.es-good { color: #4ade80; }
.es-bad  { color: #f87171; }
