/* offices map (design: prokuroriin-hayg.php, map-v4) */
/* Map height follows its 100:41.3 viewBox; colours come from tokens. */

        #block-offices .pm-map {
          /* Never wider than the container, also at 130% accessibility zoom. */
          width: min(92vw, 68rem, 100%);
        }
        #block-offices .aimag {
          fill: rgba(var(--bs-body-color-rgb), .07);
          stroke: var(--bs-body-bg);
          stroke-width: .18;
          stroke-linejoin: round;
          transition: fill .4s ease-in-out;
        }
        /* Provinces with an office in the current scope (set by JS). */
        #block-offices .aimag.has-office {
          fill: rgba(var(--bs-primary-rgb), .5);
          cursor: pointer;
        }
        #block-offices .aimag.has-office.is-active {
          fill: var(--bs-primary);
        }
        #block-offices .aimag-label {
          fill: rgba(var(--bs-body-color-rgb), .45);
          font-size: .85px;
          font-weight: 600;
          letter-spacing: .05px;
          text-anchor: middle;
          text-transform: uppercase;
          pointer-events: none;
          transition: fill .4s ease-in-out;
        }
        #block-offices .aimag-label-sm { font-size: .6px; }
        #block-offices .aimag-label.is-active { fill: var(--bs-body-bg); }

        #block-offices .compass-ring  { fill: none; stroke: rgba(var(--bs-body-color-rgb), .2); stroke-width: .12; }
        #block-offices .compass-north { fill: var(--bs-primary); }
        #block-offices .compass-south { fill: rgba(var(--bs-body-color-rgb), .2); }
        #block-offices .compass-n     { fill: rgba(var(--bs-body-color-rgb), .45); font-size: 1px; font-weight: 600; text-anchor: middle; }

        @media (max-width: 767.98px) {
          /* Province names are too small to read on small screens. */
          #block-offices .aimag-label { display: none; }
        }

        /* Floating card beside the province, centred vertically. */

        #block-offices .pm-float {
          pointer-events: auto;   /* Parent .pm-cards is pe-none, so re-enable clicks on the card links. */
          width: 19rem;
          max-width: 80vw;
          opacity: 0;
          visibility: hidden;
          /* Moving left/top lets the card slide between provinces instead of blinking. */
          transition: left .4s ease-in-out, top .4s ease-in-out,
                      opacity .4s ease-in-out, visibility .4s ease-in-out;
        }
        #block-offices .pm-float.is-active {
          opacity: 1;
          visibility: visible;
        }
        /* Compact card content: smaller title and details. */
        /* No card padding; item-details provides the spacing. */
        #block-offices .pm-float .card-item, #office-modal .card-item { padding: 0; }
        #block-offices .pm-float .item-details, #office-modal .item-details { gap: .5rem; padding: .875rem 1rem; }
        #block-offices .pm-float .item-title, #office-modal .item-title { font-size: .875rem; line-height: 1.35; }
        #block-offices .pm-float .item-spec-list, #office-modal .item-spec-list { gap: .125rem; margin-bottom: .25rem; }
        #block-offices .pm-float .item-spec-list > li, #office-modal .item-spec-list > li { flex-wrap: nowrap; font-size: .75rem; line-height: 1.4; }
        #block-offices .pm-float .item-spec-list > li > span:first-child, #office-modal .item-spec-list > li > span:first-child { flex: 0 0 3.75rem; }
        #block-offices .pm-float .item-spec-list > li > span:last-child, #office-modal .item-spec-list > li > span:last-child { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
        #block-offices .pm-float .item-spec-list a, #office-modal .item-spec-list a { color: var(--bs-primary); text-decoration: none; }
        #block-offices .pm-float .item-spec-list a:hover, #office-modal .item-spec-list a:hover { text-decoration: underline; }
        /* Left-half provinces show the card on the right, and vice versa. */
        #block-offices .pm-float[data-side="right"] { transform: translate(1rem, -50%); }
        #block-offices .pm-float[data-side="left"]  { transform: translate(calc(-100% - 1rem), -50%); }

        #block-offices .pm-hint { transition: opacity .4s ease-in-out; }
        #block-offices .pm-stage.has-active .pm-hint { opacity: 0; }

        /* Phones and tablets: no hover, so !important overrides the utility classes. */
        @media (max-width: 991.98px) {
          #block-offices .pm-cards {
            position: static !important;
            height: auto !important;
          }
          /* The card opens in #office-modal, so the floating card is hidden. */
          #block-offices .pm-float {
            display: none !important;
          }
        }

        /* Phone and tablet dialog: a white close button over the card photo. */
        #office-modal .modal-dialog { max-width: 26rem; margin-inline: auto; padding-inline: 1rem; }
        #office-modal .pm-modal-close {
          position: absolute;
          top: .75rem;
          right: .75rem;
          z-index: 2;
          width: 2.25rem;
          height: 2.25rem;
          padding: 0;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 50%;
          background: rgba(0, 0, 0, .55);
          color: #fff;
          opacity: 1;
          filter: none;
          box-shadow: none;
        }
        #office-modal .pm-modal-close:hover { background: rgba(0, 0, 0, .75); }
        #office-modal .card-item { box-shadow: none !important; }
        #block-offices .pm-map.is-ub > svg { display: none !important; }

        /* Pins sit with their tip on the location. */
        #block-offices .pm-pin {
          position: absolute;
          z-index: 2;
          padding: 0;
          border: 0;
          background: none;
          color: var(--bs-primary);
          font-size: 2rem;
          line-height: 1;
          transform: translate(-50%, -100%);
          transform-origin: 50% 100%;
          /* Outline via text-shadow, as a drop-shadow filter makes hover slow. */
          text-shadow: 0 0 1px var(--bs-body-bg), 0 0 1px var(--bs-body-bg), 0 0 1px var(--bs-body-bg),
                       0 .125rem .25rem rgba(0, 0, 0, .3);
          transition: color .4s ease-in-out, transform .4s ease-in-out;
        }
        #block-offices .pm-pin:hover,
        #block-offices .pm-pin.is-active {
          z-index: 3;
          color: var(--bs-gold);
          transform: translate(-50%, -100%) scale(1.2);
        }
        /* Offices outside the map frame: edge labels with a direction arrow. */
        #block-offices .pm-pin.is-far {
          display: inline-flex;
          align-items: center;
          gap: .375rem;
          padding: .3125rem .75rem;
          border: 1px solid rgba(var(--bs-primary-rgb), .35);
          border-radius: var(--bs-border-radius-pill);
          background-color: var(--bs-body-bg);
          font-size: .75rem;
          font-weight: 600;
          white-space: nowrap;
          filter: none;
          box-shadow: var(--bs-box-shadow-sm);
          transition: color .4s ease-in-out, background-color .4s ease-in-out, border-color .4s ease-in-out;
        }
        #block-offices .pm-pin.is-far[data-edge="left"]   { transform: translate(0, -50%); }
        #block-offices .pm-pin.is-far[data-edge="right"]  { transform: translate(-100%, -50%); }
        #block-offices .pm-pin.is-far[data-edge="top"]    { transform: translate(-50%, 0); }
        #block-offices .pm-pin.is-far[data-edge="bottom"] { transform: translate(-50%, -100%); }
        #block-offices .pm-pin.is-far:hover,
        #block-offices .pm-pin.is-far.is-active {
          color: var(--bs-white);
          background-color: var(--bs-primary);
          border-color: var(--bs-primary);
        }
        /* Phones: smaller pins and no edge labels. */
        @media (max-width: 767.98px) {
          #block-offices .pm-pin { font-size: 1.25rem; }
          #block-offices .pm-pin.is-far { display: none; }
        }

        /* Google map mode: a static iframe with a grey filter. */
        #block-offices .pm-map.pm-gmap { width: 100%; }
        #block-offices .pm-gcanvas { height: 50vh; min-height: 20rem; }
        @media (min-width: 768px) {
          #block-offices .pm-gcanvas { height: 60vh; min-height: 28rem; }
        }
        #block-offices .pm-gframe {
          opacity: .75;
          filter: grayscale(1) contrast(.9) brightness(1.12);
        }
        /* Hybrid: country view = Mongolia SVG at its own width, the Google canvas only for Ulaanbaatar */
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]):not(.is-ub) {
          width: min(92vw, 68rem, 100%);
        }
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]):not(.is-ub) .pm-gcanvas {
          display: none;
        }
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]).is-ub > .pm-pin {
          display: none;
        }

        /* Hybrid country map, Google-like: light neutral land, white borders, soft lift; offices = pins */
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) > svg {
          filter: drop-shadow(0 .25rem .75rem rgba(0, 0, 0, .06));
        }
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) .aimag,
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) .aimag.has-office {
          fill: var(--bs-secondary-bg);
          stroke: var(--bs-body-bg);
          stroke-width: .3;
        }
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) .aimag.has-office:hover,
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) .aimag.has-office.is-active {
          fill: rgba(var(--bs-primary-rgb), .12);
        }
        #block-offices .pm-map:is([data-mode="hybrid"], [data-mode="atlas"]) .aimag-label {
          fill: var(--bs-secondary-color);
        }

        /* Hybrid: the Ulaanbaatar Google map matches the Mongolia map size. */
        #block-offices .pm-map.pm-gmap[data-mode="hybrid"] {
          width: min(92vw, 68rem, 100%);
        }
        #block-offices .pm-map[data-mode="hybrid"] .pm-gcanvas {
          height: auto;
          min-height: 0;
          aspect-ratio: 100 / 41.3;
        }

        /* Atlas: both views are SVG maps of the same width. */
        #block-offices .pm-map.pm-gmap[data-mode="atlas"] {
          width: min(92vw, 68rem, 100%);
        }

        /* Left edge labels put the arrow before the name. */
        #block-offices .pm-gmap .pm-pin.is-far[data-edge="left"] { flex-direction: row-reverse; }

/* Province and office filter chips; the selected one is solid brand blue. */
#block-offices .pm-filter {
  gap: .5rem !important;
}
#block-offices .pm-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4375rem .875rem;
  border: 0;
  border-radius: .5rem;
  background-color: rgba(var(--pro-brand-deep-rgb), .06);
  color: var(--bs-body-color);
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color .4s ease-in-out, color .4s ease-in-out;
}
#block-offices .pm-chip::before {
  content: "";
  flex-shrink: 0;
  width: .375rem;
  height: .375rem;
  border-radius: 50%;
  background-color: rgba(var(--pro-brand-deep-rgb), .35);
  transition: background-color .4s ease-in-out;
}
#block-offices .pm-chip:hover,
#block-offices .pm-chip:focus-visible {
  background-color: rgba(var(--pro-brand-deep-rgb), .12);
  color: rgb(var(--pro-brand-deep-rgb));
}
#block-offices .pm-chip:hover::before,
#block-offices .pm-chip:focus-visible::before {
  background-color: rgb(var(--pro-brand-deep-rgb));
}
#block-offices .pm-chip.active {
  background-color: rgb(var(--pro-brand-deep-rgb));
  color: #fff;
}
#block-offices .pm-chip.active::before {
  background-color: var(--bs-gold);
}
