@font-face {
  font-family: 'Marselis';
  src:
    local('Marselis'),
    local('Marselis Pro'),
    url('./assets/fonts/marselis.woff') format('woff');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans';
  src: url('./assets/fonts/source-sans-pro.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --blue: #0091CD;
  --blue-hover: #006D9A;
  --gray: #3C3C41;
  --text: #0e2230;
  --bg: #f3f8fb;
  --panel: #ffffff;
  --focus: #0f5b7a;
  --shadow: 0 12px 40px rgba(16, 42, 58, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

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

body {
  display: block;
  font-family: 'Source Sans', sans-serif;
  color: var(--text);
  background: #fff;
  overflow-x: hidden;
  overflow-y: auto;
}

.app-bg {
  position: fixed;
  inset: 0;
  right: 1rem;
  z-index: 0;
  pointer-events: none;
  background: url('./assets/svgs/shape.svg') no-repeat right top / cover;
}

.top-left,
.logo,
.layout,
.legal {
  position: relative;
  z-index: 1;
}

.top-left {
  max-width: min(84rem, calc(100vw - 12rem));
  padding: clamp(1.45rem, 2.7vw, 2.3rem) clamp(1rem, 3vw, 2.2rem) 0;
  color: #fff;
}

.top-left h1 {
  margin: 0;
  font-family: 'Marselis', serif;
  font-size: clamp(1.8rem, 3vw, 3.05rem);
  line-height: 1.06;
  letter-spacing: 0.005em;
  font-weight: 700;
  color: #fff;
}

.top-left p {
  margin: 0.3rem 0 0;
  font-size: clamp(1rem, 0.96vw, 1.16rem);
  line-height: 1.25;
  max-width: 120ch;
  color: #fff;
}

.logo {
  position: absolute;
  top: clamp(1.4rem, 2.7vw, 2.15rem);
  right: clamp(1.2rem, 2.9vw, 2.45rem);
  width: clamp(132px, 17vw, 228px);
  height: auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: clamp(1rem, 2vw, 1.7rem);
  padding: clamp(0.8rem, 2vw, 1.5rem) clamp(1rem, 3vw, 2.2rem) 1.2rem;
  align-items: stretch;
  height: calc(100vh - clamp(118px, 15vh, 168px));
  min-height: 0;
  margin-bottom: 0;
}

.map-panel,
.sidebar {
  background: color-mix(in srgb, var(--panel) 94%, #dbeef8 6%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.map-panel {
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-btn:focus-visible,
.sidebar-back:focus-visible,
.map-back:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.map-wrap {
  position: relative;
  margin-top: 0;
  flex: 1;
  min-height: 0;
}

.map-back {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  width: 4rem;
  height: 4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 145, 205, 0.22);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease, background-color 140ms ease;
}

.map-wrap.is-detail-view .map-back {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.map-back:hover,
.map-back:focus-visible {
  transform: scale(1.16) !important;
  background: rgba(0, 145, 205, 0.3);
}

.map-back img {
  width: 2.35rem;
  height: 2.35rem;
  display: block;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0;
  background: transparent;
}

.state-path {
  fill: #fff;
  stroke: #a5c3d9;
  stroke-width: 1.8;
  transition: none;
  cursor: pointer;
}

.state-path:focus-visible {
  outline: none;
}

.state-path:focus {
  outline: none;
}

.state-path.is-active {
  fill: #006D9A;
}

#map.is-detail-view .state-path {
  stroke: none;
  filter: none;
}

#map.is-detail-view .state-path.is-active {
  fill: #fff;
}

#map.is-detail-view .state-path:focus-visible {
  outline: none;
}

.state-count-bubble {
  fill: #fff;
  stroke: #0091CD;
  stroke-width: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.state-count {
  font-size: 14px;
  font-weight: 700;
  fill: #0091CD;
  paint-order: stroke;
  stroke: transparent;
  stroke-width: 0;
  pointer-events: none;
}

.overview-city-badge {
  pointer-events: none;
}

.overview-city-badge-inner {
  transform-origin: center;
  transform-box: fill-box;
  transition: transform 70ms linear;
  will-change: transform;
}

.overview-city-badge.is-active .overview-city-badge-inner {
  transform: scale(1.5);
}

.overview-city-badge-circle {
  fill: #0091CD;
  stroke: none;
  stroke-width: 0;
}

.overview-city-badge-image {
  filter: none;
}

.city-marker {
  fill: #9a9ea4;
  stroke: #fff;
  stroke-width: 2;
  cursor: pointer;
  transition: fill 120ms ease, r 120ms ease;
}

.city-marker.is-active {
  fill: var(--blue-hover);
}

.city-marker:focus,
.city-marker:focus-visible {
  outline: none;
}

.city-marker-svg {
  cursor: pointer;
}

.city-marker-svg-image {
  transition: transform 120ms ease;
  transform-origin: center;
  transform-box: fill-box;
}

.city-marker-svg.is-active .city-marker-svg-image {
  transform: scale(1.15);
}

.city-marker-svg:focus,
.city-marker-svg:focus-visible {
  outline: none;
}

.city-marker-hit {
  fill: transparent;
  stroke: none;
}

.city-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: auto;
  max-width: min(420px, 92%);
  display: block;
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  background: #006D9A;
  box-shadow: 0 8px 26px rgba(8, 30, 44, 0.24);
  color: #fff;
  font-family: 'Marselis', serif;
  pointer-events: none;
}

.city-overlay[hidden] {
  display: none;
}

.city-overlay img {
  position: absolute;
  top: -34px;
  right: -44px;
  width: 132px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}

.city-overlay h2 {
  margin: 0 0 0.22rem;
  max-width: calc(100% - 88px);
  font-size: 1.9rem;
  line-height: 1.1;
  color: #fff;
}

.city-overlay-info {
  margin: 0.56rem 0 0;
  max-width: calc(100% - 88px);
  color: rgba(255, 255, 255, 0.96);
}

.city-overlay-kicker {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.12;
}

.city-overlay-row {
  margin: 0.48rem 0 0;
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  column-gap: 0.1rem;
}

.city-overlay-kicker + .city-overlay-row {
  margin-top: 0.7rem;
}

.city-overlay-value {
  font-size: 0.94rem;
  line-height: 1.08;
  color: #fff;
  letter-spacing: 0.01em;
}

.city-overlay-label {
  font-size: 0.94rem;
  line-height: 1.08;
  color: rgba(255, 255, 255, 0.98);
  white-space: nowrap;
}

.sidebar {
  padding: 0.9rem 0.95rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: rgba(241, 245, 248, 0.88);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(20, 34, 46, 0.16);
  backdrop-filter: blur(2px);
}

.sidebar h2 {
  margin: 0 0 0.2rem;
  font-family: 'Marselis', serif;
  font-size: clamp(1.95rem, 2.2vw, 2.35rem);
  line-height: 1.02;
  color: rgba(0, 145, 205, 0.74);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-back {
  border: 0;
  background: transparent;
  color: rgba(0, 145, 205, 0.88);
  font: inherit;
  font-size: 1em;
  line-height: 1;
  padding: 0 0.08em 0.02em 0;
  cursor: pointer;
}

.sidebar-back-label {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

#sidebar-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.sidebar-item {
  margin: 0;
}

.sidebar-btn {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(59, 68, 74, 0.18);
  border-radius: 0;
  background: transparent;
  color: rgba(55, 61, 66, 0.9);
  padding: 0.62rem 0.2rem 0.6rem;
  font: inherit;
  font-size: clamp(1.07rem, 1.08vw, 1.24rem);
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
}

.sidebar-btn:hover,
.sidebar-btn:focus-visible,
.sidebar-btn.is-active {
  color: #006D9A;
  background: transparent;
}

.legal {
  position: relative;
  left: auto;
  bottom: auto;
  max-width: 40rem;
  color: #1a1a1a;
  font-size: 0.78rem;
  margin: 2.4rem 0 0;
  padding: 0.25rem clamp(1rem, 3vw, 2.2rem) 0.9rem;
  clear: both;
}

@media (min-width: 1280px) {
  #sidebar-list {
    align-content: start;
  }

  .sidebar-btn {
    width: 100%;
  }
}

@media (max-width: 980px) {
  body {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    padding-bottom: 1rem;
  }

  .top-left {
    max-width: 100%;
    padding-right: 7.2rem;
  }

  .top-left h1 {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
    line-height: 1.08;
  }

  .top-left p {
    max-width: 66ch;
    font-size: clamp(0.98rem, 3.6vw, 1.12rem);
    line-height: 1.28;
  }

  .map-panel {
    min-height: auto;
  }

  .sidebar {
    min-height: 0;
    margin-top: 0.75rem;
    overflow: visible;
  }

  .sidebar h2 {
    font-size: clamp(1.9rem, 8vw, 2.3rem);
  }

  .sidebar-btn {
    font-size: clamp(1.02rem, 4vw, 1.14rem);
    padding: 0.62rem 0.2rem 0.6rem;
  }

  #sidebar-list {
    max-height: 42vh;
  }

  .map-wrap {
    min-height: clamp(310px, 54vh, 520px);
  }

  .city-overlay {
    top: auto;
    bottom: 0.8rem;
  }

  .logo {
    width: clamp(86px, 22vw, 108px);
    position: absolute;
    top: 0.65rem;
    right: 0.8rem;
  }

  .legal {
    max-width: 100%;
    font-size: 0.68rem;
    line-height: 1.25;
    padding: 0.75rem 1rem 1rem;
  }

  .app-bg {
    background-size: 200% auto;
    background-position: right top;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
