/* ==========================================================================
   Why Somerset County — interactive county map
   --------------------------------------------------------------------------
   Migrated from whysomersetnj.org, where it runs on jQuery UI tooltips. This
   site carries neither jQuery nor jQuery UI, so the behaviour is rebuilt in
   plain JS (see main.js) on the same artwork:

     <slug>.png     one flat shape per municipality, each carrying its own
                    outline; together they tile into the whole county. Hovering
                    lifts a shape's saturation, which is what makes a town
                    "light up". The live site paints these over a base image of
                    the whole county, but it sits a pixel or two off and doubles
                    every border, so it is not used here.
     <polygon>      the old <area> coords, moved into an SVG so they scale;
                    image-map coords are fixed pixels and would not

   Everything is positioned as a share of the artwork, so the map is free to be
   whatever width its column is.
   Design reference: WhySomerset_Website_2026_Life2.pdf, page 2
   ========================================================================== */

.county-map { --map-aspect: 600 / 762; }

.county-map__figure {
  position: relative;
  margin-inline: auto;
}

/* The artwork keeps its own aspect box so the absolutely-placed shapes have
   something stable to sit in. Cards are siblings of it, not children, so on a
   phone one can drop out of the artwork and flow underneath. */
.county-map__art {
  position: relative;
  aspect-ratio: var(--map-aspect);
}

/* Each town's shape, resting at the base artwork's own saturation so it is
   invisible until roused. */
.county-map__fill {
  position: absolute;
  height: auto;
  filter: saturate(100%);
  transition: filter .25s var(--ws-ease);
  pointer-events: none;
}
.county-map__fill.is-active { filter: saturate(190%) brightness(1.04); }

/* The hit layer sits over everything and carries the pointer targets. */
.county-map__hit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.county-map__hit polygon {
  fill: transparent;
  stroke: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   The card
   Comp: a white panel with a soft shadow, the town in Lilita One teal, then
   icon-and-line rows divided by hairlines.
   -------------------------------------------------------------------------- */
.county-card {
  position: absolute;
  z-index: 3;
  width: clamp(200px, 62%, 268px);
  padding: clamp(10px, 1.1vw, 16px) clamp(12px, 1.25vw, 18px) clamp(6px, .7vw, 10px);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  pointer-events: none;
}
.county-card[hidden] { display: none; }

.county-card__name {
  margin: 0 0 .4em;
  font-family: var(--ws-font-display);
  font-weight: 400;
  font-size: clamp(1.0625rem, 1.6vw, 1.375rem);
  line-height: 1.1;
  color: var(--ws-teal-ink);
  text-transform: uppercase;
  letter-spacing: .01em;
}

.county-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.county-card__list li {
  display: grid;
  grid-template-columns: clamp(18px, 1.7vw, 24px) 1fr;
  align-items: center;
  gap: clamp(7px, .7vw, 10px);
  padding: clamp(5px, .5vw, 8px) 0;
  border-top: 1px solid #e4e7e3;
  font-size: clamp(.6875rem, .85vw, .8125rem);
  line-height: 1.3;
  color: var(--ws-ink);
}
.county-card__list li:first-child { border-top: 0; }
.county-card__list img { width: 100%; height: auto; }

/* --------------------------------------------------------------------------
   Town name list — the keyboard route to everything the map does on hover
   -------------------------------------------------------------------------- */
.town-links {
  margin: clamp(14px, 1.5vw, 22px) 0 0;
  font-weight: 700;
  line-height: 1.75;
  color: var(--ws-teal-ink);
  text-transform: uppercase;
}
.town-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: color .2s var(--ws-ease);
}
.town-link:hover,
.town-link.is-active { color: var(--ws-green-mid); }
.town-link:focus-visible { outline: 3px solid var(--ws-green); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  /* At phone width the card would cover most of the county, so it drops out of
     the artwork and sits underneath it instead. */
  .county-card {
    position: static;
    width: 100%;
    margin-top: clamp(10px, 3vw, 16px);
  }
}
