html, body {
  height: 100%;
  margin: 0;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background: #f6f1e8;
  color: #1e1a17;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Serif', serif;
  margin: 0;
}

p {
  margin: 0;
}

.page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 32px;
  border-bottom: 1px solid #d7cfc2;
  background: #fdfaf4;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: #6a625b;
}

.site-header h1 {
  font-size: 40px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.subhead {
  font-size: 16px;
  color: #4d4640;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.incident-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #d7cfc2;
  background: #fffdf8;
}

.count-number {
  font-size: 24px;
  font-weight: 700;
}

.count-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

button {
  font-family: 'Noto Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid #1e1a17;
  background: transparent;
  cursor: pointer;
}

.content {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 2fr 1fr;
  min-height: 0;
  align-items: stretch;
}

.map-section {
  min-height: 0;
  display: flex;
  height: 100%;
  overflow: hidden; /* map fills this, no scroll */
}

#map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.sidebar {
  background: #fbf7ef;
  border-left: 1px solid #d7cfc2;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 0; /* important so children can scroll */
  flex: 1;
}

.sidebar-top {
  flex-shrink: 0; /* header + dropdown fixed */
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 0;
}

.sidebar h2 {
  font-size: 28px;
  margin-bottom: 20px;
}

.incident-card {
  padding: 16px 0;
  border-top: 1px solid #d7cfc2;
}

.incident-card:first-of-type {
  border-top: none;
  padding-top: 0;
}

.incident-card h3 {
  font-size: 22px;
  margin-bottom: 6px;
}

.role {
  font-size: 15px;
  margin-bottom: 4px;
}

.location {
  font-size: 10px;
  color: #5e5750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 900px) {
  .site-header {
    flex-direction: column;
  }

  .content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-left: none;
    border-top: 1px solid #d7cfc2;
  }

  #map {
    min-height: 420px;
  }
}

.sidebar-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.sidebar-top h2 {
  margin-bottom: 0;
}

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

.sort-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #4d4640;
  font-size: 12px;
}

#sort-select {
  font-family: 'Noto Sans', sans-serif;
  font-size: 13px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #d7cfc2;
  background: #fffdf8;
  color: #1e1a17;
  appearance: none;
  cursor: pointer;
}

#sort-select:hover {
  background: #f4eee3;
}

#sort-select:focus {
  outline: none;
  border-color: #8c7b68;
}

.incident-link {
  font-family: 'Noto Serif', serif;
  font-size: 22px;
  background: none;
  border: none;
  padding: 0;
  color: #1e1a17;
  cursor: pointer;
  text-align: left;
}

.incident-link:hover {
  text-decoration: underline;
}

.incident-date {
  font-size: 11px;
  color: #7a6f65;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  margin-bottom: 2px;
}

.detail-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fffdf8;
  border: 1px solid #d7cfc2;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  padding: 20px;
  z-index: 2000;
}

.close-card {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 24px;
  padding: 0;
  line-height: 1;
}

.detail-date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a6f65;
  margin-bottom: 8px;
}

.detail-card h3 {
  font-size: 28px;
  margin-bottom: 8px;
}

.detail-role {
  font-size: 16px;
  margin-bottom: 6px;
}

.detail-location {
  font-size: 11px;
  color: #5e5750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.detail-summary {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.detail-card h4 {
  font-family: 'Noto Sans', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.source-list {
  margin: 0;
  padding-left: 18px;
}

.source-list li {
  margin-bottom: 6px;
}

.source-link {
  color: #1e1a17;
  text-decoration: none;
  border-bottom: 1px solid #b9afa2;
}

.source-link:hover {
  border-bottom-color: #1e1a17;
}

.source-link.tertiary {
  font-size: 13px;
  color: #6c635b;
}

@media (max-width: 900px) {
  .sidebar-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-card {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100vw - 32px);
  max-width: 420px;
}
}