:root {
  --bright-blue: hsl(210 100% 42.9%);
  --bright-blue-lite: hsla(210 100% 55.1% / 0.34);
  --bg-white: hsl(0 0% 98.1%);
  --pale-grey: hsl(0 3.7% 84.1%);
  --dark-grey: hsl(0 0% 54.9%);
  --purple: hsl(287, 100%, 23%);
  --green: hsl(137 100% 16%);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
}

#map {
  width: 100%;
  height: 100%;
}

h1 {
  margin: 0;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--pale-grey);
}
h1:hover > span{
  color: var(--bright-blue);
}

h2 {
  font-size: 1.4rem;
}

p {
  font-size: 0.8rem;
  margin: 5px 0;
}

a {
  text-decoration: none;
  position: relative;
  color: var(--bright-blue);
}
a::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--bright-blue);
  transform-origin: right;
  transform: scaleX(0);
  transition: transform .3s ease-in-out;
}
a:hover::before {
  transform-origin: left;
  transform: scaleX(1);
}

main {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 340px;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: calc(100vh - 20px);
}
/* generic style for side info */
.sidebar-container {
  background-color: var(--bg-white);
  padding: 5px 10px;
  box-shadow: 0 0 5px var(--dark-grey);
}

.popup-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border-bottom: solid 1px var(--pale-grey);
}
#popup {
  overflow: auto;
  max-height: 100%;
}
#popup h2 {
  margin: 0;
  padding-bottom: 5px;
}
#popup img {
  width: 100%;
  height: auto;
  padding-top: 5px;
}
.collapse {
  display: none;
  overflow: hidden;
  transition: height 0.3s ease-in-out;
}
.collapse.show {
  display: block;
}

#close-button {
  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  padding: 0;
  background: transparent;
  border: none;
  width: 1em;
  height: 1em;
  font-size: 1.5rem;
  color: var(--bright-blue);
  border-radius: 50%;
  transition: background 0.2s ease-in-out;
}
#close-button:hover {
  background: var(--bright-blue-lite);
}

.chart-container {
  height: 220px;
}

label {
  font-size: 0.8rem;
}
#toggle-closest:checked {
  accent-color: var(--green);
}
#toggle-neighbourhoods:checked {
  accent-color: var(--purple);
}
select {
  font: inherit;
  font-size: 0.8rem;
  border-radius: 5px;
  border: 2px solid var(--bright-blue);
  background-color: var(--bg-white);
  color: var(--bright-blue);
}

/* tooltips */
.maplibregl-popup {
  border-radius: 5px;
}

.maplibregl-popup-content {
  padding: 5px 10px;
}

/* legend */
#legend {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  max-width: 120px;
}
#legend-title {
  margin: 0;
  text-align: center;
}
.legend-row {
  display: inline-flex;
  align-items: center;
}