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

* {
  margin: 0;
  padding: 0;
}

body {
  -webkit-font-smoothing: antialiased;
}

a {
  color: currentColor;
}

:root {
  --font-size-lg: 3.815rem;
  --font-size-md: 1.25rem;
  --font-size-sm: 1rem;

  --color-bg: #ffffff;
  --color-text: #0d0d0d;
  --color-border: #cdcdcd;
  --color-group-1: #7ebae6;
  --color-group-2: #fada7e;
  --color-group-3: #ef9090;
}

[data-group="1"] {
  --group-color: var(--color-group-1);
}

[data-group="2"] {
  --group-color: var(--color-group-2);
}

[data-group="3"] {
  --group-color: var(--color-group-3);
}

body {
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  line-height: 1.2;
  font-size: var(--font-size-md);
  background-color: var(--color-bg);
  color: var(--color-text);
}

h1,
h2 {
  font-weight: 400;
}

h1 {
  font-size: var(--font-size-lg);
  line-height: 0.8;
}

h2 {
  font-size: var(--font-size-md);
}

svg {
  font-size: var(--font-size-sm);
}

.content,
.feature {
  max-width: 32rem;
  margin: 4rem auto;
  padding-inline: 1rem;
}

.feature {
  max-width: 80rem;
  min-height: 10rem;
  position: relative;
}

.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}

.legend {
  margin-inline-start: auto;
  text-align: end;
}

.legend ul {
  list-style: none;
  display: flex;
}

.legend li {
  display: block;
  padding: 0.25rem 0.75rem;
  background-color: var(--group-color);
}

hgroup p {
  margin-block-end: 0.25rem; /* align with .legend li bottom padding */
}

.tile-grid-map {
  display: flex;
  justify-content: center;
}

.tile-grid-map svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.tile-grid-map .tile__border {
  fill: none;
  stroke-width: 4px;
  stroke: transparent;
  transition: stroke 0.1s;
}

.tile-grid-map .tile.active .tile__border {
  stroke: currentColor;
}

.tile-grid-map .tile__label {
  user-select: none;
  fill: currentColor;
}

.age-group-chart .axis {
  font-family: inherit;
  font-size: var(--font-size-sm);
}

.age-group-chart .axis line,
.age-group-chart .axis path {
  stroke: var(--color-border);
}

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: rgb(255 255 255 / 50%);
  backdrop-filter: blur(16px);
  visibility: hidden;
  opacity: 0;
  transition:
    visibility 0.1s,
    opacity 0.1s;
}

.tooltip.visible {
  visibility: visible;
  opacity: 1;
}

.tooltip h2 {
  margin-block-end: 0.5rem;
}

.footer {
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.loading::after {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 45px;
  aspect-ratio: 1;
  background:
    no-repeat linear-gradient(var(--color-group-1) 0 0) 0% 50%,
    no-repeat linear-gradient(var(--color-group-2) 0 0) 50% 50%,
    no-repeat linear-gradient(var(--color-group-3) 0 0) 100% 50%;
  background-size: 20% 100%;
  animation: loader 1s infinite linear;
}
@keyframes loader {
  0% {
    background-size:
      20% 100%,
      20% 100%,
      20% 100%;
  }
  33% {
    background-size:
      20% 10%,
      20% 100%,
      20% 100%;
  }
  50% {
    background-size:
      20% 100%,
      20% 10%,
      20% 100%;
  }
  66% {
    background-size:
      20% 100%,
      20% 100%,
      20% 10%;
  }
  100% {
    background-size:
      20% 100%,
      20% 100%,
      20% 100%;
  }
}
