/* Abstand zum Footer, falls location-map mal das letzte Element vor ihm ist
   (aktuell in keinem Layout der Fall) — sonst bleibt es 0, weil die jeweils
   folgende Section ihr eigenes Top-Padding mitbringt. */
main > .location-map:last-child .inner {
  padding-bottom: var(--space-block);
}

@media (width <= 991px) {
  main > .location-map:last-child .inner {
    padding-bottom: var(--space-block-medium);
  }
}

@media (width <= 479px) {
  main > .location-map:last-child .inner {
    padding-bottom: var(--space-block-small);
  }
}

@scope (.location-map) {
  :scope {
    background-color: var(--color-bg-blue);
  }

  .inner {
    padding: 7rem 5% 0;
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(17rem, 0.82fr) minmax(0, 1.18fr);
    align-items: stretch;
    gap: 2rem;
  }

  .content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }

  h2 {
    text-wrap: balance;
    color: var(--color-blue);
    margin-block: 0.1em 0.3em;
    font-size: 2.2em;
    font-weight: 500;
  }

  .copy {
    color: var(--color-text);
    font-size: 0.9em;
    margin-bottom: 0;
  }

  .copy p {
    margin: 0 0 1em;
    font-size: inherit;
  }

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

  .city-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .info-card {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
  }

  .info-card.is-hidden {
    display: none;
  }

  .info-label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--color-blue);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
  }

  .info-card h3 {
    margin: 0 0 0.4em;
    color: var(--color-orange);
    font-size: 1.4em;
    font-weight: 500;
    line-height: 1.2;
  }

  .card {
    display: grid;
    grid-template-rows: minmax(28rem, 1fr) auto;
    overflow: hidden;
    min-width: 0;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
  }

  .canvas {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28rem;
    overflow: hidden;
    background: var(--color-white);
  }

  .map-frame {
    position: relative;
    width: min(76%, 30rem);
    aspect-ratio: 471.61 / 632.9;
  }

  .zoom-layer {
    position: absolute;
    inset: 0;
    transform: scale(var(--scale, 1));
    transform-origin: var(--origin-x, 50%) var(--origin-y, 50%);
    transition:
      transform 0.45s ease,
      transform-origin 0.45s ease;
  }

  .zoom-layer.is-zoomed .marker {
    width: 0.25rem;
    height: 0.25rem;
    box-shadow:
      0 0 0 1.5px var(--color-blue),
      0 2px 5px #2f333d22;
  }

  .zoom-layer.is-zoomed .marker:hover,
  .zoom-layer.is-zoomed .marker.is-active {
    box-shadow:
      0 0 0 1.5px var(--color-grey),
      0 3px 8px #2f333d2e;
  }

  .zoom-layer.is-zoomed .marker-label {
    left: 0.48rem;
    font-size: 0.62rem;
    padding: 0.07rem 0.2rem;
  }

  .map-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
  }

  .service-area {
    position: absolute;
    left: 3.5%;
    top: 38.5%;
    width: 24%;
    aspect-ratio: 1;
    border: 2px dashed var(--color-orange);
    border-radius: 100%;
    background: #ffab0026;
    pointer-events: none;
  }

  .marker {
    position: absolute;
    z-index: 3;
    width: 0.25rem;
    height: 0.25rem;
    border: 0;
    border-radius: 100px;
    background: var(--color-white);
    box-shadow:
      0 0 0 2.5px var(--color-blue),
      0 3px 9px #2f333d26;
    cursor: pointer;
    padding: 0;
    transform: translate(-50%, -50%);
    transition:
      background-color 0.2s ease,
      box-shadow 0.2s ease,
      transform 0.2s ease;
  }

  .marker-label,
  .reference-label {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-grey);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
    opacity: 0;
    background: #ffffffe6;
    border-radius: 3px;
    padding: 0.1rem 0.25rem;
    box-shadow: 0 2px 8px #2f333d1c;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }

  .marker:hover,
  .marker.is-active {
    z-index: 20;
    background: var(--color-orange);
    box-shadow:
      0 0 0 2.5px var(--color-grey),
      0 6px 16px #2f333d33;
    transform: translate(-50%, -50%) scale(1.08);
  }

  .marker:hover .marker-label,
  .marker.is-active .marker-label {
    opacity: 1;
  }

  .reference-marker {
    position: absolute;
    z-index: 2;
    width: 0.56rem;
    height: 0.56rem;
    border-radius: 100px;
    background: #7b8790;
    box-shadow: 0 0 0 3px #ffffffd9;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .reference-marker.is-labeled .reference-label {
    opacity: 0.78;
    left: 0.75rem;
    color: #505c5c;
    font-size: 0.68rem;
    box-shadow: none;
  }

  .legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #d6e1ea;
    color: var(--color-grey);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.35;
  }

  .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .legend i {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 100px;
    flex: 0 0 auto;
  }

  .legend-focus {
    background: var(--color-blue);
    opacity: 0.65;
  }

  .legend-reference {
    background: #7b8790;
  }

  /* .chip: rendert per JS als <button class="chip">, siehe location-map.js */
  .chip {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    cursor: pointer;
    border: 0.175em solid var(--color-orange);
    border-radius: var(--radius);
    background-color: var(--color-white);
    color: var(--color-text);
    font-size: 1.125rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.6;
    padding: 0.2rem 0.9rem;

    &:hover,
    &:focus-visible {
      background-color: var(--color-orange);
      color: var(--color-text);
    }
  }

  .chip.is-active {
    background: var(--color-orange);
  }

  @media (width <= 991px) {
    .inner {
      padding-top: 6rem;
    }

    .layout {
      grid-template-columns: 1fr;
    }

    .card {
      grid-template-rows: minmax(26rem, 1fr) auto;
    }

    .canvas {
      min-height: 26rem;
    }
  }

  @media (width <= 767px) {
    .inner {
      padding-top: 4rem;
    }

    .eyebrow {
      font-size: 0.8em;
    }

    h2 {
      font-size: 1.6em;
    }

    .copy {
      font-size: 0.8em;
    }

    .info-card {
      padding: 1.2rem;
    }

    .info-card h3 {
      font-size: 1.2em;
    }

    .chip {
      font-size: 0.7em;
    }

    .legend {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  @media (width <= 479px) {
    .inner {
      padding-inline: 4vw;
    }

    .layout {
      gap: 1.5rem;
    }

    .city-group {
      gap: 0.55rem;
    }

    .card {
      grid-template-rows: minmax(22rem, 1fr) auto;
    }

    .canvas {
      min-height: 22rem;
    }

    .map-frame {
      width: min(88%, 24rem);
    }

    .marker-label {
      font-size: 0.68rem;
    }
  }
}
