:root {
  --border: #d0d0d0;
  --orange-text: #CC4B00;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Open Sans", sans-serif;
  color: #1f1f1f;
  background: #ffffff;
}

.app-shell {
  display: grid;
  grid-template-columns: 0 816px;
  width: 816px;
  height: 730px;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: grid-template-columns 0.24s ease;
}

.app-shell.sidebar-open {
  grid-template-columns: 320px 496px;
}

.info-panel {
  padding: 3.3rem 1rem 1rem;
  border-right: 1px solid var(--border);
  background: #fff;
  overflow: auto;
}

.sidebar-toggle {
  position: fixed;
  top: 0.75rem;
  left: 4rem;
  z-index: 1200;
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 0;
  padding: 0.52rem 0.8rem;
  font-weight: 700;
  color: #111114;
  background: white;
  cursor: pointer;
}

.sidebar-toggle.sidebar-open-pos {
  top: 0.75rem;
  left: 1rem;
}

.filters {
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.filters label {
  color: #222;
  font-size: 0.84rem;
  font-weight: 700;
}

.filters input,
.filters select,
.filters button {
  border: 1px solid #bdbdbd;
  border-radius: 0;
  background: #fff;
  color: #222;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.45rem 0.55rem;
}

.filters input::placeholder {
  color: #777;
}

.filters select[multiple] {
  min-height: 8.5rem;
  padding: 0.25rem;
}

.year-range-group {
  display: grid;
  gap: 0.45rem;
}

.dual-range {
  position: relative;
  height: 28px;
  padding: 8px 0;
}

.dual-range-track,
.dual-range-selected {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
}

.dual-range-track {
  background: #cfcfcf;
}

.dual-range-selected {
  background: #ff7a2f;
  left: 0;
  right: 0;
}

.dual-range input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid #666;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border: 1px solid #666;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.dual-range input[type="range"]::-moz-range-track {
  background: transparent;
}

.year-range-values {
  display: grid;
  grid-template-columns: 42px auto 24px auto;
  gap: 0.35rem;
  align-items: center;
}

.year-range-values span {
  font-size: 0.85rem;
  color: #444;
}

.year-range-values output {
  min-width: 2.8rem;
  text-align: left;
  font-size: 0.9rem;
}

.filters button {
  margin-top: 0.25rem;
  cursor: pointer;
  background: #f3f3f3;
}

.filter-results {
  margin-bottom: 0.9rem;
}

.filter-results h3 {
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
}

.filter-results ul {
  margin: 0;
  padding-left: 16px;
  max-height: 220px;
  overflow: auto;
}

.filter-results li {
  margin: 0 0 0.3rem;
}

.filter-results a {
  color: var(--orange-text);
  text-decoration: none;
}

.filter-results a:hover {
  background: #e9e9f0;
}

.filter-results-empty {
  color: #666;
  list-style: none;
  margin-left: -16px;
}

#status {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  font-size: 0.92rem;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.person-popup {
  min-width: 260px;
  max-width: 360px;
}

.person-popup .popup-content {
  display: flex;
  gap: 0.7rem;
  line-height: 1.2;
}

.person-popup .popup-left {
  flex: 0 0 106px;
}

.person-popup .popup-left img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.person-popup .popup-right {
  flex: 1;
  min-width: 0;
}

.person-popup .popup-name {
  color: var(--orange-text);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.person-popup .popup-location {
  margin: 0 0 0.5rem;
  color: #2f2f37;
}

.person-popup .popup-link {
  color: var(--orange-text);
  text-decoration: none;
  font-weight: 500;
}

.person-popup .popup-link:hover {
  background: #e9e9f0;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  overflow: hidden;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
}

.profile-modal-card {
  position: relative;
  margin: 0;
  width: min(860px, 100%);
  max-width: 100%;
  max-height: calc(100% - 1.5rem);
  overflow: auto;
  background: #fff;
  color: #272727;
  border-radius: 0;
  padding: 1rem 1rem 0.85rem;
}

.profile-modal-close {
  position: absolute;
  right: 0.6rem;
  top: 0.25rem;
  border: none;
  background: transparent;
  font-size: 1.9rem;
  cursor: pointer;
  color: #444;
}

.profile-head {
  display: grid;
  grid-template-columns: 25% 75%;
  gap: 0.85rem;
  margin-bottom: 0.95rem;
  align-items: start;
}

.profile-image-wrap {
  text-align: right;
}

.profile-image-wrap img {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.profile-head-text h2 {
  color: var(--orange-text);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.profile-head-text p {
  margin: 0;
}

.profile-row {
  display: grid;
  grid-template-columns: 25% 75%;
  gap: 0.65rem;
  padding: 0.42rem 0;
  align-items: start;
}

.profile-label {
  font-weight: 700;
  text-align: right;
  padding-right: 0.35rem;
}

.profile-value > div {
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}

.profile-quote {
  text-align: center;
  font-style: oblique;
  font-family: "Times New Roman", Times, serif;
}

.profile-modal a {
  color: var(--orange-text);
  text-decoration: none;
}

.profile-modal a:hover {
  background: #e9e9f0;
}

.cluster-popup ul {
  margin: 0;
  padding-left: 15px;
  max-height: 240px;
  overflow: auto;
}

.cluster-popup li {
  margin: 0 0 0.35rem;
}

.cluster-popup .infowindow-list {
  list-style-type: none;
}

.cluster-popup a {
  color: var(--orange-text);
  text-decoration: none;
}

.cluster-popup a:hover {
  color: var(--orange-text);
  background: #e9e9f0;
}

.custom-cluster {
  background: transparent;
  border: none;
}

.cluster-icon-wrap {
  position: relative;
  display: inline-block;
}

.cluster-icon-wrap img {
  display: block;
  width: 100%;
  height: 100%;
}

.cluster-icon-wrap span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #000;
  font-weight: 700;
}

@media (max-width: 920px) {
  /* Leaflet sets maxWidth as an inline style; override it so popups can't
     exceed the visible map width on narrow screens. */
  .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 48px) !important;
  }

  .leaflet-popup-content {
    max-width: calc(100vw - 80px);
    overflow-wrap: anywhere;
  }

  .person-popup {
    min-width: 0;
    max-width: calc(100vw - 80px);
  }

  .person-popup .popup-content {
    flex-wrap: wrap;
  }

  .cluster-popup ul {
    max-height: 160px;
  }

  .profile-modal {
    align-items: flex-start;
    padding: 0.5rem;
  }

  .profile-modal-card {
    width: 100%;
    max-height: calc(100% - 1rem);
  }

  .profile-head {
    grid-template-columns: 1fr;
  }

  .profile-image-wrap {
    text-align: left;
  }

  .profile-row {
    grid-template-columns: 1fr;
  }

  .profile-label {
    text-align: left;
    padding-right: 0;
  }
}
