/* Shared, accessible fullscreen viewer for every map-like report surface. */
.ig-map-expand-frame,
.ig-map-expand-surface {
  position: relative;
}

.ig-map-expand-frame {
  width: 100%;
}

.ig-map-expand-frame > .ig-mini-map {
  margin: 0 !important;
}

.ig-map-expand-btn {
  position: absolute;
  z-index: 1001;
  top: 10px;
  right: 10px;
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(17, 49, 31, .2);
  border-radius: 9px;
  background: rgba(255, 255, 255, .96);
  color: #123c27;
  box-shadow: 0 2px 8px rgba(8, 36, 21, .16);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.ig-map-expand-btn:hover {
  background: #f0f8f2;
}

.ig-map-expand-btn:focus-visible,
.ig-map-viewer__close:focus-visible {
  outline: 3px solid #f0b429;
  outline-offset: 2px;
}

.ig-map-expand-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.ig-map-viewer {
  position: fixed;
  z-index: 10000;
  inset: 0 auto 0 50%;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #e9f0eb;
  color: #122d1e;
  transform: translateX(-50%);
}

.ig-map-viewer::backdrop {
  background: rgba(4, 20, 11, .76);
}

.ig-map-viewer.ig-map-viewer--fallback-open {
  display: block;
}

.ig-map-viewer__shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.ig-map-viewer__header {
  z-index: 2;
  display: flex;
  min-height: 64px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid #c4d1c8;
  background: #fff;
}

.ig-map-viewer__header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #173c29;
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-map-viewer__close {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #aebdb2;
  border-radius: 9px;
  background: #f4f8f5;
  color: #173c29;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ig-map-viewer__close span:first-child {
  font-size: 23px;
  font-weight: 500;
  line-height: .7;
}

.ig-map-viewer__stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  place-items: stretch;
  overflow: auto;
  background: #d9e4dc;
}

.ig-map-viewer__stage > .ig-map-viewer__surface {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 100% !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

.ig-map-viewer__stage > .ig-mini-map {
  overflow: hidden;
}

.ig-map-viewer__stage > .ig-truth-hero,
.ig-map-viewer__stage > .ig-geom-sketch,
.ig-map-viewer__stage > .ig-mpzp-plan {
  display: grid;
  place-items: center;
  overflow: auto;
  background: #eef3ef;
}

html body.has-map-shell .ig-map-viewer .ig-map-viewer__stage > .ig-truth-hero .parcel-hero-canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  object-fit: contain;
}

.ig-map-viewer__stage > .ig-geom-sketch .ig-parcel-svg,
.ig-map-viewer__stage > .ig-mpzp-plan img,
.ig-map-viewer__stage > .ig-mpzp-plan canvas {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ig-map-viewer__stage .ig-map-expand-btn {
  display: none !important;
}

/* The ordinary report hero keeps its compact caption. Only the reparented
   fullscreen hero gets a bottom caption lane, above attribution/meta. */
html body.has-map-shell .ig-map-viewer .ig-map-viewer__stage > .ig-truth-hero .ig-truth-hero__caption{
  position:absolute!important;inset:auto 0 calc(28px + env(safe-area-inset-bottom,0px))!important;
  align-self:auto!important;width:auto!important;margin:0!important;padding:34px 14px 10px!important;
  border-radius:0!important;background:linear-gradient(to top,rgba(4,20,12,.94) 0%,rgba(4,20,12,.72) 52%,transparent 100%)!important;
}
html body.has-map-shell .ig-map-viewer .ig-map-viewer__stage > .ig-truth-hero .ig-truth-hero__meta{
  position:absolute!important;inset:auto 10px max(6px,env(safe-area-inset-bottom,0px))!important;
  z-index:2!important;padding:0!important;color:#d6eadb!important;text-shadow:0 1px 3px #000!important;
}
@media(max-width:420px){html body.has-map-shell .ig-map-viewer .ig-map-viewer__stage > .ig-truth-hero .ig-truth-hero__caption{padding:28px 12px 8px!important}}

.ig-map-viewer__placeholder {
  width: 100%;
}

body.ig-map-viewer-open {
  overflow: hidden !important;
}

@media (max-width: 520px) {
  .ig-map-expand-btn {
    top: 8px;
    right: 8px;
    padding: 8px;
  }

  .ig-map-expand-btn > span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .ig-map-viewer__close > span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ig-map-expand-btn,
  .ig-map-viewer,
  .ig-map-viewer * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media print {
  .ig-map-expand-btn,
  .ig-map-viewer,
  .ig-map-viewer__placeholder {
    display: none !important;
  }
}

/* T27 (27.09): rysunek MPZP w powiększeniu pokazujemy w całości, a zielony
   obrys musi leżeć dokładnie na rastrze. Okno rysunku dostaje proporcje
   rastra GetMap (840×640 ≈ viewBox SVG 1000×760), więc obraz i nakładka
   wypełniają je 1:1 — bez przycinania i bez rozciągania samej nakładki. */
.ig-map-viewer__stage > .ig-mpzp-plan {
  container-type: size;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ig-map-viewer__stage > .ig-mpzp-plan .ig-mpzp-plan__viewport {
  flex: 0 0 auto;
  width: min(100cqw, calc((100cqh - 56px) * 1.3125)) !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 840 / 640;
}
.ig-map-viewer__stage > .ig-mpzp-plan .ig-mpzp-plan__viewport img { object-fit: fill !important; }
.ig-map-viewer__stage > .ig-mpzp-plan figcaption { width: min(100cqw, calc((100cqh - 56px) * 1.3125)); box-sizing: border-box; }
