:root {
  --baw-op-accent: #f5d547;
  --baw-op-accent-ink: #1a1a1a;
  --baw-op-panel: rgba(247, 244, 239, 0.97);
  --baw-op-ink: #243028;
  --baw-op-muted: #5c6b63;
  --baw-op-line: rgba(36, 48, 40, 0.12);
  --baw-op-green: #6f9b56;
  --baw-op-radius: 14px;
  --baw-op-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.baw-objektplan {
  --baw-op-ink: var(--fs-navy, #28364B);
  --baw-op-muted: #5c6b63; /* legacy-edge-fallback */
  --baw-op-muted: color-mix(in srgb, var(--fs-navy, #28364B) 62%, transparent);
  color: var(--baw-op-ink);
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 2rem;
}

.baw-objektplan *,
.baw-objektplan *::before,
.baw-objektplan *::after {
  box-sizing: border-box;
}

.baw-objektplan__header {
  position: relative;
  margin: 0 0 1.5rem;
}

.baw-objektplan__header.fs-section-head {
  margin-bottom: 1.5rem;
}

.baw-objektplan .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.baw-objektplan__lead {
  margin: 0.85rem auto 0;
  max-width: 42rem;
  font-family: var(--fs-font-body, 'Raleway', sans-serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--baw-op-muted);
  text-align: center;
}

.baw-objektplan__stage {
  position: relative;
  z-index: 1;
  width: auto;
  overflow: visible;
}

.baw-objektplan.is-detail .baw-objektplan__stage {
  z-index: 4;
}

.baw-objektplan__layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1.5rem;
  width: 100%;
  position: relative;
}

.baw-objektplan__layout .baw-objektplan__legend {
  /* Nur so breit wie die zweispaltige Liste – kein Flex-Wachstum (sonst Riesenabstand) */
  flex: 0 1 auto;
  width: auto;
  min-width: 16rem;
  max-width: 32rem;
  margin-top: 0;
  max-height: 70vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
  text-align: left;
  align-self: flex-start;
}

.baw-objektplan__layout .baw-objektplan__mobile-top {
  /* Kartenbreite vom JS – rechtsbündig ohne leere Flex-Spalte */
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: calc(100% - 17.5rem);
  margin-left: auto;
  position: relative;
  z-index: 2;
}

.baw-objektplan__viewport {
  position: relative;
  overflow: hidden;
  border-radius: var(--baw-op-radius);
  background: #dfe8da;
  border: 1px solid var(--baw-op-line);
  width: auto;
  max-width: 100%;
  min-width: 220px;
  height: 62vh;
  max-height: 72vh;
  min-height: 260px;
  touch-action: manipulation;
  cursor: grab;
  margin-left: 0;
}

.baw-objektplan__canvas {
  position: absolute;
  left: 0;
  top: 0;
  /* Ohne JS: Karte füllt Viewport (sonst 0×0 weil absolute ohne Maße) */
  width: 100%;
  height: 100%;
  line-height: 0;
  transform-origin: 0 0;
  will-change: transform;
  transition: transform 480ms var(--baw-op-ease);
}

.baw-objektplan__map,
.component-area .baw-objektplan__map {
  display: block;
  /* Fallback bis JS naturalWidth/Height setzt */
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  /* Breite/Höhe setzt JS auf naturalWidth/Height → scharfer Zoom aus Full-Res */
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.baw-objektplan__markers {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  container-type: inline-size;
  container-name: baw-map;
  z-index: 2;
}

.baw-objektplan__floor-overlays {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.baw-objektplan__floor-overlays[hidden] {
  display: none !important;
}

.baw-objektplan__floor-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  pointer-events: none;
  line-height: 0;
}

.baw-objektplan__floor-overlay,
.component-area .baw-objektplan__floor-overlay {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  width: auto;
  height: auto;
  max-width: none !important;
  max-height: none !important;
  transform: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.baw-objektplan__floor-markers {
  position: absolute;
  top: 0; /* legacy-edge-fallback */
  right: 0; /* legacy-edge-fallback */
  bottom: 0; /* legacy-edge-fallback */
  left: 0; /* legacy-edge-fallback */
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.baw-objektplan__marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* % der Highres-Karte; JS setzt in der Übersicht feste Bildschirmgröße */
  width: 2.2%;
  height: 2.2%;
  min-width: 24px;
  min-height: 24px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--baw-op-accent);
  color: var(--baw-op-accent-ink);
  font-weight: 800;
  font-size: 0.55em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: box-shadow 180ms var(--baw-op-ease), outline 180ms ease;
  z-index: 2;
  pointer-events: auto;
}

@supports (aspect-ratio: 1) {
  .baw-objektplan__marker {
    height: auto;
  }
}

.baw-objektplan__marker.is-child {
  width: 1.55%;
  min-width: 18px;
  min-height: 18px;
  font-size: 0.45em;
  background: var(--baw-op-accent);
  color: var(--baw-op-accent-ink);
  z-index: 4;
}

.baw-objektplan__marker.is-free {
  background: var(--baw-op-green);
  color: #fff;
}

.baw-objektplan__marker.is-floor-child {
  width: 3%;
  min-width: 26px;
  min-height: 26px;
  font-size: 0.5em;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.16);
}

.baw-objektplan__marker.is-child.is-pill,
.baw-objektplan__marker.is-floor-child.is-pill {
  width: auto;
  padding: 0 0.4em;
}

.baw-objektplan.is-detail .baw-objektplan__marker {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(111, 155, 86, 0.28);
  overflow: visible;
  z-index: 5;
}

.baw-objektplan.is-detail .baw-objektplan__marker.is-child,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child {
  color: var(--baw-op-accent-ink);
}

.baw-objektplan.is-detail .baw-objektplan__marker.is-child.is-free,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child.is-free {
  color: #fff;
}

.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child.is-pill {
  aspect-ratio: auto;
}

.baw-objektplan.is-detail .baw-objektplan__marker.is-child.is-selected,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child.is-selected {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 12px 24px rgba(0, 0, 0, 0.18);
  z-index: 6;
}

.baw-objektplan__legend-child button,
.baw-objektplan__legend-child a {
  padding-left: 1.25rem !important;
  opacity: 0.92;
}

.baw-objektplan__occupancy {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(36, 48, 40, 0.06);
}

.baw-objektplan__occupancy-label {
  font-size: 0.92rem;
  font-weight: 700;
}

.baw-objektplan__occupancy-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.baw-objektplan__occupancy-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.baw-objektplan__occupancy-track {
  width: 2.6rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--baw-op-accent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  position: relative;
  transition: background 160ms ease;
}

.baw-objektplan__occupancy-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.35rem - 4px);
  height: calc(1.35rem - 4px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 160ms ease;
}

.baw-objektplan__occupancy-switch input:checked + .baw-objektplan__occupancy-track {
  background: var(--baw-op-green);
}

.baw-objektplan__occupancy-switch input:checked + .baw-objektplan__occupancy-track::after {
  transform: translateX(1.25rem);
}

.baw-objektplan__occupancy-state {
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 3.5rem;
}

/* Mehr als 2 Zeichen → Pille, Breite wächst mit dem Text */
.baw-objektplan__marker.is-pill {
  width: auto;
  min-width: 2.2cqw;
  height: 2.2cqw;
  min-height: 24px;
  aspect-ratio: auto;
  padding: 0 0.55em;
}

@supports not (height: 1cqw) {
  .baw-objektplan__marker.is-pill {
    min-width: 2.2%;
    height: auto;
    padding: 0.35em 0.55em;
  }
}

.baw-objektplan__marker:hover,
.baw-objektplan__marker.is-active{
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 12px 24px rgba(0, 0, 0, 0.18);
  z-index: 3;
}
.baw-objektplan__marker:focus-visible{
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 12px 24px rgba(0, 0, 0, 0.18);
  z-index: 3;
}

.baw-objektplan__marker:focus-visible {
  outline-color: var(--baw-op-green);
}

/* Hover-Label: Gebäudename unter dem Marker (nur Übersicht, Desktop-Hover)
   Gegen-Skalierung: Labels sitzen in der Canvas und würden sonst mit der Karte winzig. */
@media (hover: hover) and (pointer: fine) {
  .baw-objektplan:not(.is-detail) .baw-objektplan__marker[data-name]::after {
    content: attr(data-name);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(var(--baw-op-inv-scale, 1));
    transform-origin: top center;
    padding: 0.35em 0.7em;
    border-radius: 999px;
    background: rgba(36, 48, 40, 0.94);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms var(--baw-op-ease);
    z-index: 4;
  }

  .baw-objektplan:not(.is-detail) .baw-objektplan__marker[data-name]:hover::after{
    opacity: 1;
  }
.baw-objektplan:not(.is-detail) .baw-objektplan__marker[data-name]:focus-visible::after{
    opacity: 1;
  }

  /* Unterpins im Detail-Zoom: gleicher Hover-Name wie in der Übersicht */
  .baw-objektplan.is-detail .baw-objektplan__marker.is-child[data-name]::after,
  .baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child[data-name]::after {
    content: attr(data-name);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(var(--baw-op-inv-scale, 1));
    transform-origin: top center;
    padding: 0.35em 0.7em;
    border-radius: 999px;
    background: rgba(36, 48, 40, 0.94);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms var(--baw-op-ease);
    z-index: 8;
  }

  .baw-objektplan.is-detail .baw-objektplan__marker.is-child[data-name]:hover::after,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child[data-name]:hover::after{
    opacity: 1;
  }
.baw-objektplan.is-detail .baw-objektplan__marker.is-child[data-name]:focus-visible::after,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child[data-name]:focus-visible::after{
    opacity: 1;
  }
}

/* Mobile / ausgewählt: Name unter dem Unterpin (kein Hover nötig) */
.baw-objektplan.is-detail .baw-objektplan__marker.is-child.is-selected[data-name]::after,
.baw-objektplan.is-detail .baw-objektplan__marker.is-floor-child.is-selected[data-name]::after {
  content: attr(data-name);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(var(--baw-op-inv-scale, 1));
  transform-origin: top center;
  padding: 0.35em 0.7em;
  border-radius: 999px;
  background: rgba(36, 48, 40, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 1;
  pointer-events: none;
  z-index: 8;
}

/* Aktiver Marker im Detail: gelber Punkt ~12px Bildschirmgröße, kein Label, nicht klickbar */
.baw-objektplan.is-detail .baw-objektplan__marker.is-active:not(.is-child),
.baw-objektplan.is-detail .baw-objektplan__marker.is-active.is-pill:not(.is-child) {
  width: calc(12px * var(--baw-op-inv-scale, 1)) !important;
  height: calc(12px * var(--baw-op-inv-scale, 1)) !important;
  min-width: calc(12px * var(--baw-op-inv-scale, 1)) !important;
  min-height: calc(12px * var(--baw-op-inv-scale, 1)) !important;
  padding: 0 !important;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 0 !important;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  outline: 2px solid #fff !important;
  outline-offset: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  cursor: default;
  z-index: 2;
}

.baw-objektplan.is-detail .baw-objektplan__marker.is-active:not(.is-child)::after {
  content: none !important;
  display: none !important;
}

/* Overlay sitzt am linken Kartenrand – ca. 90 % über der Legende, 10 % über der Karte */
.baw-objektplan__panel {
  position: absolute;
  z-index: 6;
  left: 0;
  right: auto;
  top: 0.75rem;
  width: 360px;
  max-width: 360px; /* legacy-edge-fallback */
  max-width: min(360px, 42vw);
  max-height: 70vh;
  max-height: 70vh; /* legacy-edge-fallback */
  max-height: min(70vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--baw-op-radius);
  background: var(--baw-op-panel);
  border: 1px solid var(--baw-op-line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 1.1rem 1.25rem;
  animation: baw-op-panel-in 280ms var(--baw-op-ease) both;
  text-align: left;
  transform: translateX(-90%);
}

@media (max-width: 767px) {
  .baw-objektplan__panel {
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    bottom: -0.5rem;
    width: auto;
    max-width: none;
    transform: none;
  }
}

.baw-objektplan__mobile-info {
  display: none;
}

.baw-objektplan__mobile-info[hidden] {
  display: none !important;
}

/* Kein display:contents — Safari/VoiceOver entfernt sonst Marker & Interaktion aus dem A11y-Tree */
.baw-objektplan__mobile-top {
  display: block;
}

.baw-objektplan__lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.75rem 0.75rem 0.75rem; /* legacy-edge-fallback */
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  box-sizing: border-box;
  overflow: hidden;
  background: rgba(12, 18, 14, 0.88);
  cursor: zoom-out;
}

.baw-objektplan__lightbox[hidden] {
  display: none !important;
}

.baw-objektplan__lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  cursor: zoom-out;
  pointer-events: auto;
}

.baw-objektplan__lightbox-close {
  position: absolute;
  top: 0.75rem; /* legacy-edge-fallback */
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.85rem; /* legacy-edge-fallback */
  right: max(0.85rem, env(safe-area-inset-right));
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--baw-op-ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.baw-objektplan__panel[hidden] {
  display: none !important;
}

.baw-objektplan__panel:not([hidden]) {
  display: block;
  visibility: visible;
  opacity: 1;
}

.baw-objektplan__backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(20, 28, 22, 0.14);
  cursor: pointer;
  animation: baw-op-fade-in 200ms ease both;
  border-radius: var(--baw-op-radius);
  /* Klicks sollen Marker/Karte erreichen → direkter Wechsel ohne erst rauszoomen */
  pointer-events: none;
}

.baw-objektplan__backdrop[hidden] {
  display: none !important;
}

.baw-objektplan__panel-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
}

.baw-objektplan__back,
.baw-objektplan__edit {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--baw-op-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}

.baw-objektplan__back:hover,
.baw-objektplan__edit:hover{
  color: var(--baw-op-ink);
}
.baw-objektplan__back:focus-visible,
.baw-objektplan__edit:focus-visible{
  color: var(--baw-op-ink);
}

.baw-objektplan__edit[hidden] {
  display: none !important;
}

.baw-objektplan__mobile-edit {
  display: inline-block;
  margin: 0 0 0.55rem;
  color: var(--baw-op-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.baw-objektplan__mobile-edit:hover{
  color: var(--baw-op-ink);
}
.baw-objektplan__mobile-edit:focus-visible{
  color: var(--baw-op-ink);
}

.baw-objektplan__panel-body {
  margin: 0;
  padding: 0;
}

.baw-objektplan__panel .baw-objektplan__building-title,
.baw-objektplan__panel h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.45rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.baw-objektplan__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.8rem;
  height: 1.8rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--baw-op-accent);
  color: var(--baw-op-accent-ink);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.baw-objektplan__badge.is-pill {
  width: auto;
  padding: 0 0.55rem;
}

.baw-objektplan__intro {
  margin: 0 0 1rem;
  color: var(--baw-op-muted);
  line-height: 1.45;
}

.baw-objektplan__intro p {
  margin: 0 0 0.65em;
}

.baw-objektplan__intro p:last-child {
  margin-bottom: 0;
}

.baw-objektplan__intro ul,
.baw-objektplan__intro ol {
  margin: 0 0 0.65em;
  padding-left: 1.25em;
}

.baw-objektplan__intro a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.baw-objektplan__intro strong,
.baw-objektplan__intro b {
  color: var(--baw-op-ink);
  font-weight: 700;
}

.baw-objektplan__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.baw-objektplan__meta span {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(111, 155, 86, 0.16);
  color: var(--baw-op-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.baw-objektplan__detail-media {
  margin: 0 0 1rem;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.baw-objektplan__detail-media button,
.baw-objektplan__doc-image button {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: block;
  width: 100%;
  cursor: zoom-in;
  background: transparent;
}

.baw-objektplan__detail-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  background: #f3f0ea;
}

.baw-objektplan__doc-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0 0 1rem;
  align-items: start;
}

.baw-objektplan__doc-image {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--baw-op-line);
}

.baw-objektplan__doc-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  background: #f3f0ea;
}

.baw-objektplan__doc-image figcaption {
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  color: var(--baw-op-muted);
}

.baw-objektplan__floors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.baw-objektplan__floor-tab {
  appearance: none;
  border: 1px solid var(--baw-op-line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--baw-op-ink);
}

.baw-objektplan__floor-tab.is-active {
  background: var(--baw-op-ink);
  color: #fff;
  border-color: var(--baw-op-ink);
}

.baw-objektplan__floorplan {
  display: none;
}

.baw-objektplan__downloads {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  list-style: none;
}

.baw-objektplan__downloads > li,
.baw-objektplan__downloads li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.baw-objektplan__downloads > li::before,
.baw-objektplan__downloads li::before {
  content: none !important;
  display: none !important;
}

.baw-objektplan__downloads a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--baw-op-line);
  color: var(--baw-op-ink);
  text-decoration: none;
  font-weight: 600;
}

.baw-objektplan__downloads a:hover{
  border-color: var(--baw-op-green);
}
.baw-objektplan__downloads a:focus-visible{
  border-color: var(--baw-op-green);
}

.baw-objektplan__legend {
  display: block;
  margin-top: 0;
  text-align: left;
  position: relative;
  z-index: 0;
  width: 100%;
  max-width: none !important;
}

.baw-objektplan__legend-extra {
  display: block;
  margin-top: 1.5rem;
  width: 100%;
  max-width: none !important;
  position: relative;
  z-index: 0;
  text-align: left;
  clear: both;
}

.baw-objektplan.is-detail .baw-objektplan__legend,
.baw-objektplan.is-detail .baw-objektplan__legend-extra {
  z-index: 0;
}

.baw-objektplan__legend-title {
  margin: 0 0 0.55rem;
  font-family: var(--fs-font-display, 'Playfair Display', Georgia, serif);
  font-weight: 400;
  font-size: 1.55rem; /* legacy-edge-fallback */
  font-size: clamp(1.35rem, 2vw, 1.55rem);
  line-height: 1.25;
  color: var(--fs-navy, #28364B);
}

/* Desktop: zweispaltig, Breite am Inhalt – nicht über die ganze Seite ziehen */
.baw-objektplan__legend-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: stretch;
  gap: 0.15rem 0.85rem;
  width: max-content !important;
  max-width: 32rem !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  float: none !important;
  columns: auto !important;
  text-align: left;
}

.baw-objektplan__legend-list > * {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: none;
  float: none;
  text-align: left;
}

.baw-objektplan__legend-list > *::before,
.baw-objektplan__legend-list > *::marker {
  content: none;
  display: none;
}

.baw-objektplan__legend-list button,
.baw-objektplan__legend-list a {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  max-width: none;
  padding: 0.15rem 0;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.baw-objektplan__legend-child {
  grid-column: 1 / -1;
}

.baw-objektplan__legend-list button:hover,
.baw-objektplan__legend-list a:hover{
  color: var(--baw-op-green);
}
.baw-objektplan__legend-list button:focus-visible,
.baw-objektplan__legend-list a:focus-visible{
  color: var(--baw-op-green);
}

.baw-objektplan__legend-list .baw-objektplan__badge {
  flex: 0 0 auto;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  background: var(--baw-op-accent);
  color: var(--baw-op-accent-ink);
}

.baw-objektplan__legend-list .baw-objektplan__badge.is-pill {
  width: auto;
  padding: 0 0.5rem;
}

.baw-objektplan__legend-list button > span:last-child,
.baw-objektplan__legend-list a > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

/* —— Mobile: sticky Karte+Info, Legende scrollt mit der Seite —— */
@media (max-width: 767px) {
  .baw-objektplan {
    --baw-op-sticky-top: var(--header-h-mobile, 78px);
    display: block;
    height: auto;
    max-height: none;
    min-height: 0;
    padding: 0 0 1.5rem;
    overflow: visible;
  }

  .baw-objektplan__header {
    margin-bottom: 0.85rem;
    padding: 0 0.15rem;
  }

  .baw-objektplan__header.fs-section-head {
    margin-bottom: 0.85rem;
  }

  .baw-objektplan__lead {
    font-size: 0.98rem;
  }

  /* Visuell ausblenden, aber für Screenreader/„Seite anhören“ behalten */
  .baw-objektplan__lead {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .baw-objektplan__layout {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.35rem;
  }

  .baw-objektplan__layout .baw-objektplan__legend {
    order: 2;
    flex: none;
    max-height: none;
    overflow: visible;
    min-width: 0;
    width: 100%;
    margin-top: 0.75rem;
    z-index: 0;
    align-self: stretch;
  }

  /* Spezifischer als Desktop-Regel (.layout .mobile-top { position: relative }) */
  .baw-objektplan__layout .baw-objektplan__mobile-top {
    order: 1;
    flex: none;
    margin-left: 0;
    width: 100%;
    position: -webkit-sticky;
    position: sticky;
    top: var(--baw-op-sticky-top);
    align-self: flex-start;
    z-index: 8;
  }

  .baw-objektplan__mobile-top {
    display: block;
    background: var(--baw-op-panel);
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .baw-objektplan.is-detail .baw-objektplan__mobile-top {
    /* Platz für Info-Karte, die leicht unter die Map hängt */
    padding-bottom: 0.85rem;
  }

  .baw-objektplan__stage {
    position: relative;
    height: 42vh;
    min-height: 200px;
    max-height: 360px;
    width: 100%;
    z-index: 1;
    overflow: visible;
  }

  .baw-objektplan.is-detail .baw-objektplan__stage {
    z-index: 2;
  }

  .baw-objektplan__viewport {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    min-height: 0;
    border-radius: 10px;
    margin-left: 0;
  }

  .baw-objektplan__panel,
  .baw-objektplan__backdrop {
    display: none !important;
  }

  .baw-objektplan__markers,
  .baw-objektplan__floor-markers {
    pointer-events: none;
  }

  .baw-objektplan__marker {
    pointer-events: auto;
  }

  /* Info-Overlay: nur leicht in die Karte, Rest darunter → Pin bleibt sichtbar */
  .baw-objektplan__mobile-info {
    display: block;
    position: absolute;
    left: 50%;
    top: calc(100% - 10px);
    bottom: auto;
    transform: translateX(-50%);
    z-index: 6;
    width: 78%;
    max-width: 260px;
  width: 78%; /* legacy-edge-fallback */
  width: min(78%, 260px);
    margin: 0;
    padding: 0.65rem 0.7rem 0.6rem;
    border-radius: 12px;
    background: var(--baw-op-panel);
    border: 1px solid var(--baw-op-line);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    text-align: left;
    max-height: 42vh;
    overflow-x: hidden;
    overflow-y: auto;
    pointer-events: auto;
  }

  .baw-objektplan__mobile-info-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 2rem;
    height: 2rem;
    display: grid;
  align-items: center; /* legacy-edge-fallback */
  justify-items: center; /* legacy-edge-fallback */
  place-items: center;
    border: 0;
    border-radius: 0 12px 0 10px;
    background: transparent;
    color: var(--baw-op-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
  }

  .baw-objektplan__mobile-info-close:hover{
    color: var(--baw-op-ink);
  }
.baw-objektplan__mobile-info-close:focus-visible{
    color: var(--baw-op-ink);
  }

  .baw-objektplan__mobile-info[hidden] {
    display: none !important;
  }

  .baw-objektplan__mobile-info .baw-objektplan__building-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 1.5rem 0.35rem 0;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .baw-objektplan__mobile-info .baw-objektplan__building-title > span:last-child {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700;
  }

  .baw-objektplan__mobile-info .baw-objektplan__badge {
    flex: 0 0 auto;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.35rem;
    font-size: 0.72rem;
  }

  .baw-objektplan__mobile-info .baw-objektplan__meta {
    margin: 0 0 0.25rem;
  }

  .baw-objektplan__mobile-info .baw-objektplan__meta span {
    font-size: 0.72rem;
    padding: 0.12rem 0.4rem;
  }

  .baw-objektplan__mobile-info .baw-objektplan__intro {
    margin: 0 0 0.3rem;
    font-size: 0.8rem;
  }

  .baw-objektplan__mobile-info .baw-objektplan__detail-media {
    margin: 0.3rem auto 0;
    width: 100%;
    max-width: 132px;
  width: 100%; /* legacy-edge-fallback */
  width: min(100%, 132px);
    max-height: none;
    border-radius: 8px;
    overflow: hidden;
    background: #e8efe4;
  }

  .baw-objektplan__mobile-info .baw-objektplan__detail-media button {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
    background: transparent;
  }

  .baw-objektplan__mobile-info .baw-objektplan__detail-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
  }

  .baw-objektplan__legend {
    position: relative;
    z-index: 1;
    margin-top: 0.25rem;
    margin-bottom: 0;
    overflow: visible;
    padding: 0 0.1rem 1rem;
    /* Abstand, wenn Info-Karte nach unten hängt */
  }

  .baw-objektplan.is-detail .baw-objektplan__legend {
    margin-top: 7.5rem;
  }

  .baw-objektplan__legend-title {
    position: static;
    margin: 0 0 0.4rem;
    padding: 0;
    background: transparent;
  font-size: 1.45rem; /* legacy-edge-fallback */
  font-size: clamp(1.25rem, 4vw, 1.45rem);
  }

  .baw-objektplan__legend-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.15rem 0.65rem !important;
    text-align: left;
  }

  .baw-objektplan__legend-list button,
  .baw-objektplan__legend-list a {
    min-height: 48px;
    padding: 0.55rem 0.25rem;
    font-size: 1rem;
    gap: 0.65rem;
    border-radius: 10px;
    justify-content: flex-start;
    text-align: left;
  }

  .baw-objektplan__legend-list button:hover,
.baw-objektplan__legend-list a:hover{
    color: inherit;
    background: rgba(111, 155, 86, 0.1);
  }
.baw-objektplan__legend-list button:focus-visible,
.baw-objektplan__legend-list a:focus-visible{
    color: inherit;
    background: rgba(111, 155, 86, 0.1);
  }

  .baw-objektplan__legend-list button.is-active,
  .baw-objektplan__legend-list a.is-active {
    background: rgba(245, 213, 71, 0.35);
  }

  .baw-objektplan__legend-list .baw-objektplan__badge {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
  }

  .baw-objektplan__legend-extra {
    display: block;
    margin-top: 1rem;
    padding: 0 0.15rem;
  }

  .baw-objektplan__empty {
    padding: 0.5rem 0;
  }
}

.baw-objektplan__empty {
  padding: 1rem 0;
  color: var(--baw-op-muted);
}

@keyframes baw-op-panel-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes baw-op-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .baw-objektplan__canvas {
    transition: none !important;
  }

  .baw-objektplan__panel,
  .baw-objektplan__backdrop {
    animation: none !important;
  }
}
