/* interactive-map — a pannable map with hotspots and a directory beside it.
   The panel is navy with white type and hairline rules, from the Las Vegas
   directory comp. The side colours are the artwork's own: its blue is not a
   brand token, so it lives here; its red is exactly --color-red. */
.imap {
  --imap-blue: #0a62e2;
  --imap-rule: #ffffff2e;
  --imap-panel-h: min(78vh, 760px);

  /* Two sizes, because the two marker styles do different jobs. A dot IS the
     badge, so it is sized to hold a number. A ring SURROUNDS a badge already
     printed on the artwork, so it has to clear it: Las Vegas prints its A-F
     badges 44px across, measured off the file, and 48 leaves the ring sitting
     just outside with 2px of air. A property whose map prints a different
     badge overrides --imap-ring rather than editing this. */
  --imap-marker: 38px;
  --imap-ring: 48px;
}
.imap [hidden] { display: none !important; }

.imap__panel {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: var(--imap-panel-h);
  background: var(--color-navy);
  color: var(--color-white);
  border-radius: var(--radius-card);
  overflow: hidden;
}

/* ---- Directory ------------------------------------------------------- */
.imap__sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--imap-rule);
}
.imap__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--imap-rule);
}
.imap__title {
  margin: 0;
  font-family: var(--font-display-condensed);
  font-weight: var(--weight-poster-heavy);
  text-transform: uppercase;
  line-height: .9;
  font-size: clamp(2rem, 3vw, 2.75rem);
  color: var(--color-white);
}
.imap__pdf {
  margin-left: auto;
  color: var(--color-white);
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.imap__directory { overflow-y: auto; padding: 6px 24px 24px; }

.imap__category + .imap__category { margin-top: 10px; }
.imap__category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 10px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.imap__category-name {
  font-family: var(--font-display-condensed);
  font-weight: var(--weight-poster-heavy);
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 1.2rem;
  line-height: 1.1;
}
.imap__category-name--blue { background: var(--imap-blue); padding: 3px 10px; }
.imap__category-name--red  { background: var(--color-red); padding: 3px 10px; }
.imap__category-name--gold { color: var(--color-gold); }
.imap__chev {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
  opacity: .8;
}
.imap__category-toggle[aria-expanded="false"] .imap__chev { transform: rotate(-45deg); }
.imap__category-toggle:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }

.imap__locations,
.imap__legend-list { list-style: none; margin: 0; padding: 0; }
.imap__location-item,
.imap__legend-item { border-top: 1px solid var(--imap-rule); }

.imap__location {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.imap__location:hover .imap__location-name,
.imap__location.is-active .imap__location-name { color: var(--color-gold); }
.imap__location:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }

/* The house badge: a white ring with the key inside, as printed on the map. */
.imap__badge {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 2px solid var(--color-white);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .8rem;
  line-height: 1;
  color: var(--color-white);
}
.imap__badge--wide { min-width: 44px; }
.imap__location.is-active .imap__badge { background: var(--color-gold); border-color: var(--color-gold); color: var(--color-navy); }
.imap__icon { flex: 0 0 auto; width: 28px; height: 28px; object-fit: contain; }

.imap__detail { padding: 0 0 12px 40px; color: #ffffffd1; font-size: .95rem; }
.imap__detail p { margin: 0; }

.imap__legend { margin-top: 22px; }
.imap__legend-title { margin: 0 0 6px; color: #ffffff8c; }
.imap__legend-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-weight: 600; }

/* ---- Map ------------------------------------------------------------- */
.imap__map {
  position: relative;
  overflow: hidden;
  background: #e5e5e5;
  touch-action: none;
  cursor: grab;
}
.imap__map.is-grabbing { cursor: grabbing; }
.imap__canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.imap__img {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.imap__marker {
  position: absolute;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  width: var(--imap-marker);
  height: var(--imap-marker);
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .8rem;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.imap__marker--dot { color: var(--color-white); background: var(--color-navy); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.imap__marker--dot.imap__marker--red   { background: var(--color-red); }
.imap__marker--dot.imap__marker--blue  { background: var(--imap-blue); }
.imap__marker--dot.imap__marker--gold  { background: var(--color-gold); color: var(--color-navy); }
.imap__marker--dot.imap__marker--white { background: var(--color-white); color: var(--color-navy); }

/* Rings: invisible until hovered or picked, because the artwork already shows
   the badge underneath. */
.imap__marker--ring {
  background: transparent;
  width: var(--imap-ring);
  height: var(--imap-ring);
}
.imap__marker--ring:hover { box-shadow: 0 0 0 3px var(--color-white), 0 0 0 6px var(--color-navy); }

/* The selected marker: gold, on a navy keyline.

   Gold is the selection colour because it is the brand's accent and because
   the directory beside the map already turns a chosen row's badge gold. The
   keyline is what makes it survive, and it is not decoration - gold alone was
   measured against the three grounds a marker actually lands on and failed
   all of them:

       gold on white (badges A-F)  2.39:1
       gold on #e70a03 (red)       1.98:1
       gold on #0082d6 (blue)      1.57:1

   Navy carries it instead: 13.95:1 on white, 2.95 on red, 3.72 on blue, and
   5.84 between the navy and the gold, so the two bands stay distinct from
   each other as well as from the map.

   Hover keeps the neutral white-and-navy ring, so "pointing at" and "chosen"
   are different states rather than two weights of the same one. */
.imap__marker.is-active {
  z-index: 2;
  box-shadow: 0 0 0 4px var(--color-gold), 0 0 0 7px var(--color-navy);
}
/* A dot grows, because a dot is the badge and has nothing to stay aligned to.
   A ring does not: it is drawn around a badge printed on the artwork, and a
   scale step pushes it off that badge, which reads as a misprint rather than
   as a selection. The ring appearing is the whole signal it needs. */
.imap__marker--dot.is-active { transform: translate(-50%, -50%) scale(1.2); }

/* Focus stays distinguishable from selection: same two colours, reversed, so a
   keyboard user can tell "where I am" from "what is chosen". */
.imap__marker:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-navy), 0 0 0 6px var(--color-white); }

.imap__controls { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; }
.imap__control {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--color-white);
  color: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.imap__control:hover { background: var(--gray-100); }
.imap__control:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.imap__control svg { width: 20px; height: 20px; }

/* ---- No script, or the editor preview --------------------------------
   A static, fitted map: the whole thing visible, markers still positioned,
   nothing to drag. The editor preview never runs the script, because dragging
   would fight Gutenberg's own block selection. */
.imap[data-preview] .imap__panel,
html:not(.ub-js) .imap__panel { height: auto; }
.imap[data-preview] .imap__map,
html:not(.ub-js) .imap__map { cursor: default; touch-action: auto; }
.imap[data-preview] .imap__canvas,
html:not(.ub-js) .imap__canvas { position: relative; width: 100% !important; height: auto !important; }
.imap[data-preview] .imap__img,
html:not(.ub-js) .imap__img { width: 100%; height: auto; }
.imap[data-preview] .imap__controls,
html:not(.ub-js) .imap__controls { display: none; }

/* ---- Below 1024px ----------------------------------------------------
   The map comes first and the directory follows it down the page. No bottom
   sheet, so nothing for a fixed cookie banner to cover. */
@media (max-width: 1023px) {
  .imap__panel { grid-template-columns: 1fr; height: auto; }
  .imap__map { order: -1; height: 62vh; min-height: 320px; }
  .imap__sidebar { border-right: 0; border-top: 1px solid var(--imap-rule); }
  .imap__directory { overflow: visible; }
  .imap[data-preview] .imap__map,
  html:not(.ub-js) .imap__map { height: auto; min-height: 0; }
}
