@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-weight: 400;
  src: url('vendor/alfa-slab-one.woff2') format('woff2');
}

:root {
  --water: #D8E6EB;
  --water-deep: #C4D8E0;
  --chart: #FDFDFA;
  --land: #EFECE2;
  --land-line: #FDFDFA;
  --ink: #253440;
  --ink-soft: #5D707D;
  --all-red: #D7263D;
  --display: 'Alfa Slab One', 'Rockwell', serif;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--water);
  background-image: radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.5), transparent 60%);
}

.app {
  display: flex;
  height: 100%;
}

/* ---------- Sidebar ---------- */

.sidebar {
  flex: 0 0 250px;
  background: var(--chart);
  border-right: 1px solid var(--water-deep);
  box-shadow: 4px 0 24px rgba(37, 52, 64, .06);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.masthead h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.4rem;
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--ink);
}

.tagline {
  margin-top: 10px;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.backlink {
  display: inline-block;
  margin-top: 12px;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.backlink:hover { color: var(--ink); }

.members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-family: var(--body);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

.member:hover { background: rgba(37, 52, 64, .05); }

.member:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.member .swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c);
  flex-shrink: 0;
}

.member .count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-soft);
}

.member.active {
  background: var(--c);
  border-color: color-mix(in srgb, var(--c) 70%, black);
  color: #fff;
}

.member.active.dark-text { color: var(--ink); }

.member.active .count { color: inherit; opacity: .85; }

.hint {
  margin-top: auto;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--ink-soft);
  border-top: 1px dashed var(--water-deep);
  padding-top: 16px;
}

/* ---------- Map ---------- */

.map-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vmin;
  min-width: 0;
}

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

.state {
  fill: var(--land);
  stroke: var(--land-line);
  stroke-width: 1;
  stroke-linejoin: round;
}

.state.togglable { cursor: pointer; }

.state.togglable:hover {
  filter: brightness(.93);
}

.state.stamp {
  animation: stamp .35s ease-out;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes stamp {
  0%   { transform: scale(1.25); }
  60%  { transform: scale(.96); }
  100% { transform: scale(1); }
}

/* ---------- Tooltip ---------- */

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
  z-index: 10;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--water-deep);
    padding: 16px;
    gap: 12px;
  }
  .masthead h1 { font-size: 1.5rem; }
  .masthead h1 br { display: none; }
  .members { flex-direction: row; flex-wrap: wrap; }
  .member { width: auto; padding: 6px 10px; font-size: .85rem; }
  .hint { display: none; }
  .map-panel { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .state.stamp { animation: none; }
  .member { transition: none; }
}
