/* Explore the Data page */

/* ---------- Layout ---------- */

.data-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: min(80%, 1100px);
  margin: 0 auto 40px;
  font-family: "Amiko", sans-serif;
}

.data-card {
  background-color: #f3f3f3;
  min-width: 0;
}

@media (min-width: 900px) {
  .data-page {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .data-wide { grid-column: span 12; }
  .data-map  { grid-column: span 8; }
  .data-side { grid-column: span 4; }
  .data-half { grid-column: span 6; }
}

@media (max-width: 767px) {
  .data-page {
    width: auto;
    margin: 0 12px 32px;
  }
}

.dataheading {
  background-color: #282C34;
  font-family: "Libre Franklin", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  text-align: center;
  padding: 1.5rem 1rem;
  margin: 0;
}

.data-body {
  padding: 1rem 1.25rem 0.5rem;
}

#highlights {
  font-family: "Amiko", sans-serif;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

#dataintro ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

#dataintro ul li {
  padding: 0.25rem 0;
}

.chart-title {
  background-color: #282C34;
  font-family: "Amiko", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  color: #fff;
  padding: 12px 16px;
  margin: 0;
}

.chart-source {
  color: gray;
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0;
  padding: 6px 12px 10px;
}

.chart-source a {
  color: gray;
  text-decoration: underline;
}

.chart {
  padding: 12px 8px;
  overflow: hidden;
}

#borough-chart {
  display: flex;
  justify-content: center;
}

#intMap {
  height: 550px;
  width: 100%;
  background: #f3f3f3;
}

@media (max-width: 767px) {
  #intMap {
    height: 420px;
  }
}

.mapInfo {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 5px;
  padding: 4px 6px;
  font-family: "Amiko", sans-serif;
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 220px;
}

.mapLegend span {
  display: block;
}

.mapLegend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  opacity: 0.8;
}

/* ---------- legends ---------- */

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-legend li {
  display: flex;
  align-items: center;
}

.key-dot {
  display: inline-block;
  flex: none;
  height: 14px;
  width: 14px;
  margin-right: .4em;
  border-radius: 50%;
}

/* ---------- charts ---------- */

.axis path,
.axis line {
  fill: none;
  stroke: grey;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.overlay {
  fill: none;
  pointer-events: all;
}

.line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-width: 2.5px;
}

.focus-line {
  stroke: #999;
  stroke-dasharray: 3 3;
}

.rate:hover {
  stroke-width: 2px;
  stroke: teal;
}

.graph-svg-component text,
.pie-wrap,
#stacked-chart text {
  font-family: "Amiko", sans-serif;
}

.pie-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 32px;
  padding: 16px;
}

.pie-wrap .legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.pie-wrap .key {
  display: flex;
  align-items: center;
}

.pie-wrap .symbol {
  height: 10px;
  width: 10px;
  margin: 5px;
  border-radius: 50%;
}

/* ---------- race/ethnicity chart ---------- */

.race-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px 16px 0;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-toggle button {
  background-color: darkgray;
  border: none;
  color: white;
  padding: 6px 12px;
  font-size: 1rem;
  cursor: pointer;
  font-family: "Amiko", sans-serif;
}

.view-toggle button[aria-pressed="true"] {
  background-color: #282C34;
}

.race-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.race-legend li {
  display: flex;
  align-items: center;
}

.marker-key {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 50%;
}

.marker-pop { border: 2.5px solid #345995; background: #f3f3f3; }
.marker-dx { background: #E40066; }

.race-caption {
  margin: 10px 16px 0;
  font-size: 1rem;
  color: #282C34;
}

#race-chart text {
  font-family: "Amiko", sans-serif;
}

.race-label {
  font-size: 14px;
  font-weight: 700;
  fill: #282C34;
}

.race-value {
  font-size: 13px;
  fill: #555;
  font-variant-numeric: tabular-nums;
}

.race-grid line {
  stroke: #dcdcdc;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

#race-chart .axis path {
  display: none;
}

.race-average line {
  stroke: #282C34;
  stroke-width: 1;
}

.race-average text {
  font-size: 12px;
  fill: #282C34;
}

.race-row {
  transition: opacity 0.2s;
}

.race-row.is-dimmed {
  opacity: 0.35;
}

.data-table {
  margin: 0 16px;
  font-size: 0.85rem;
}

.data-table summary {
  cursor: pointer;
  color: #555;
}

.data-table table {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #dcdcdc;
  text-align: right;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

/* One tooltip shared by every chart */
.chart-tooltip {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  max-width: 240px;
  padding: 6px 8px;
  font-family: "Amiko", sans-serif;
  font-size: 0.85rem;
  line-height: 1.35;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: opacity 0.15s;
}
