/**
 * HPW Parkplan – Frontend
 * Präfix: hpwmap (kollidiert nicht mit .hpwm / .hpwmd)
 */
.hpwmap {
  --hpwmap-navy: #05143E;
  --hpwmap-blue: #0057A8;
  --hpwmap-gold: #E2A63D;
  --hpwmap-red: #5C0500;
  --hpwmap-bg: #F5F7FA;
  --hpwmap-glass: rgba(255, 255, 255, .78);
  --hpwmap-border: rgba(5, 20, 62, .12);
  --hpwmap-shadow: 0 10px 30px rgba(5, 20, 62, .18);
  --hpwmap-radius: 16px;
  --hpwmap-h: 70vh;
  position: relative;
  height: var(--hpwmap-h);
  min-height: 260px;
  border-radius: var(--hpwmap-radius);
  overflow: hidden;
  background: #EEF1EC;
  color: var(--hpwmap-navy);
  isolation: isolate;
  container-type: inline-size;
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.hpwmap *, .hpwmap *::before, .hpwmap *::after { box-sizing: border-box; }
.hpwmap--page { --hpwmap-h: calc(100svh - 170px); min-height: 420px; }
.hpwmap--module { --hpwmap-h: 320px; }
.hpwmap--inline { --hpwmap-h: 340px; margin: 1.25rem 0; }
.hpwmap--detail { --hpwmap-h: 300px; }

.hpwmap-canvas { position: absolute; inset: 0; }
.hpwmap.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid rgba(5, 20, 62, .15); border-top-color: var(--hpwmap-gold); border-radius: 50%;
  animation: hpwmap-spin .8s linear infinite; z-index: 5;
}
@keyframes hpwmap-spin { to { transform: rotate(360deg); } }
.hpwmap-noscript { padding: 1rem; }

.hpwmap.is-fullscreen {
  position: fixed; inset: 0; z-index: 10000; height: 100%; height: 100dvh; border-radius: 0; margin: 0;
}
html.hpwmap-noscroll, html.hpwmap-noscroll body { overflow: hidden; }

.hpwmap-ico { display: inline-flex; line-height: 0; }

/* ---------------- Overlay ---------------- */
.hpwmap-ui { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.hpwmap-ui > * { pointer-events: auto; }

.hpwmap-bar {
  position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: flex-start;
  pointer-events: none;
}
.hpwmap-bar > * { pointer-events: auto; }

.hpwmap-search { position: relative; flex: 1 1 auto; max-width: 380px; }
.hpwmap-search > .hpwmap-ico { position: absolute; z-index: 1; left: 14px; top: 50%; transform: translateY(-50%); color: rgba(5, 20, 62, .55); pointer-events: none; }
.hpwmap-search input {
  width: 100%; height: 44px; padding: 0 14px 0 40px; border: 1px solid var(--hpwmap-border); border-radius: 999px;
  background: var(--hpwmap-glass); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 4px 16px rgba(5, 20, 62, .12); font: inherit; font-size: 16px; color: var(--hpwmap-navy); outline: none;
  -webkit-appearance: none; appearance: none;
}
.hpwmap-search input:focus { border-color: var(--hpwmap-gold); box-shadow: 0 0 0 4px rgba(226, 166, 61, .25), 0 4px 16px rgba(5, 20, 62, .12); }
.hpwmap-results {
  position: absolute; left: 0; right: 0; top: 50px; margin: 0; padding: 6px; list-style: none; max-height: 330px; overflow: auto;
  background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--hpwmap-border); border-radius: 14px; box-shadow: var(--hpwmap-shadow);
}
.hpwmap-results li { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.hpwmap-results li.is-active, .hpwmap-results li:hover { background: rgba(0, 87, 168, .08); }
.hpwmap-results li.is-empty { color: rgba(5, 20, 62, .6); cursor: default; background: none; }
.hpwmap-results-dot {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c); font-size: 13px;
}
.hpwmap-results-txt { display: flex; flex-direction: column; min-width: 0; }
.hpwmap-results-txt strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpwmap-results-txt small { color: rgba(5, 20, 62, .6); font-size: 12px; }

.hpwmap-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hpwmap-border); background: var(--hpwmap-glass); color: var(--hpwmap-navy); font: inherit; font-weight: 600;
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 4px 16px rgba(5, 20, 62, .12);
  position: relative;
}
.hpwmap-btn:hover { background: #fff; }
.hpwmap-btn.is-active { background: var(--hpwmap-navy); color: #fff; border-color: var(--hpwmap-navy); box-shadow: 0 0 0 4px rgba(226, 166, 61, .3), 0 4px 16px rgba(5, 20, 62, .2); }
.hpwmap-btn.has-filter::after {
  content: ""; position: absolute; top: 7px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--hpwmap-gold);
  box-shadow: 0 0 0 2px #fff;
}

/* Panel (Ebenen + Zeitreise) */
.hpwmap-panel {
  position: absolute; top: 64px; right: 12px; width: 330px; max-width: calc(100% - 24px); max-height: calc(100% - 140px); overflow: auto;
  padding: 14px; border-radius: var(--hpwmap-radius); border: 1px solid var(--hpwmap-border);
  background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--hpwmap-shadow);
}
.hpwmap-seg { display: flex; padding: 3px; border-radius: 999px; background: rgba(5, 20, 62, .07); margin-bottom: 12px; }
.hpwmap-seg button {
  flex: 1; border: 0; background: none; padding: 7px 6px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: rgba(5, 20, 62, .75);
}
.hpwmap-seg button.is-active { background: #fff; color: var(--hpwmap-navy); box-shadow: 0 2px 8px rgba(5, 20, 62, .15); }
.hpwmap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hpwmap-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); background: color-mix(in srgb, var(--c) 12%, #fff);
  color: var(--hpwmap-navy); font: inherit; font-size: 13.5px; font-weight: 600; transition: opacity .15s, filter .15s;
}
.hpwmap-chip .fa { color: var(--c); width: 1.1em; text-align: center; }
.hpwmap-chip.is-off { opacity: .45; filter: grayscale(1); background: #fff; }
.hpwmap-timeline { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hpwmap-border); }
.hpwmap-timeline-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.hpwmap-timeline-year { font-family: "Francois One", sans-serif; font-size: 22px; color: var(--hpwmap-red); letter-spacing: .02em; }
.hpwmap-timeline input[type=range] { width: 100%; accent-color: var(--hpwmap-red); }
.hpwmap-timeline input[type=range]:disabled { opacity: .35; }
.hpwmap-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; margin: 0; }
.hpwmap-switch input { position: absolute; opacity: 0; pointer-events: none; }
.hpwmap-switch-ui { width: 38px; height: 22px; border-radius: 999px; background: rgba(5, 20, 62, .2); position: relative; transition: background .2s; }
.hpwmap-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.hpwmap-switch input:checked + .hpwmap-switch-ui { background: var(--hpwmap-red); }
.hpwmap-switch input:checked + .hpwmap-switch-ui::after { transform: translateX(16px); }
.hpwmap-switch input:focus-visible + .hpwmap-switch-ui { box-shadow: 0 0 0 3px rgba(226, 166, 61, .5); }
.hpwmap-panel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: rgba(5, 20, 62, .65); }
.hpwmap-link { border: 0; background: none; padding: 0; color: var(--hpwmap-blue); font: inherit; font-weight: 600; cursor: pointer; }

/* ---------------- Marker ---------------- */
.hpwmap-pin {
  display: flex; flex-direction: column; align-items: center; border: 0; background: none; padding: 0; cursor: pointer;
  color: inherit; font: inherit;
}
.hpwmap-pin[hidden], .hpwmap-arealabel[hidden] { display: none !important; }
.hpwmap-pin-dot {
  position: relative; width: 32px; height: 32px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--c); border: 2px solid #fff; box-shadow: 0 3px 10px rgba(5, 20, 62, .35);
  display: grid; place-items: center; transition: transform .15s, box-shadow .15s;
}
.hpwmap-pin-dot .fa { transform: rotate(45deg); color: #fff; font-size: 14px; }
.hpwmap-pin.is-shape .hpwmap-pin-dot { width: 28px; height: 28px; }
.hpwmap-pin:hover .hpwmap-pin-dot, .hpwmap-pin:focus-visible .hpwmap-pin-dot { transform: rotate(-45deg) scale(1.1); }
.hpwmap-pin:focus-visible { outline: none; }
.hpwmap-pin.is-selected { z-index: 2; }
.hpwmap-pin.is-selected .hpwmap-pin-dot {
  transform: rotate(-45deg) scale(1.22);
  box-shadow: 0 0 0 4px rgba(226, 166, 61, .45), 0 0 22px 6px rgba(226, 166, 61, .55), 0 4px 12px rgba(5, 20, 62, .35);
}
.hpwmap-pin.is-former .hpwmap-pin-dot { border-color: #F4DEDA; box-shadow: 0 0 0 1px rgba(92, 5, 0, .5), 0 3px 10px rgba(5, 20, 62, .35); }
.hpwmap-pin.is-planned .hpwmap-pin-dot { border-color: var(--hpwmap-gold); opacity: .9; }
.hpwmap-pin-label {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 4px); white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .88); color: var(--hpwmap-navy); box-shadow: 0 1px 4px rgba(5, 20, 62, .18);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.hpwmap.is-labels .hpwmap-pin-label, .hpwmap-pin.is-selected .hpwmap-pin-label, .hpwmap-pin:hover .hpwmap-pin-label { opacity: 1; }
.hpwmap-arealabel {
  border: 0; background: none; padding: 0; cursor: pointer; opacity: 0; transition: opacity .2s; pointer-events: none;
  font-family: "Francois One", sans-serif; font-size: 15px; letter-spacing: .04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 70%, #05143E);
  text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 10px #fff;
}
.hpwmap.is-areas .hpwmap-arealabel { opacity: .95; pointer-events: auto; }
.hpwmap.is-static .hpwmap-pin, .hpwmap.is-static .hpwmap-arealabel { cursor: pointer; }

/* ---------------- Detail-Karte (Sheet) ---------------- */
.hpwmap-sheet {
  position: absolute; left: 12px; top: 68px; width: 330px; max-height: calc(100% - 80px); overflow: auto;
  border-radius: var(--hpwmap-radius); background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--hpwmap-border); box-shadow: var(--hpwmap-shadow);
  transform: translateY(8px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.hpwmap-sheet.is-open { transform: none; opacity: 1; }
.hpwmap-sheet[hidden] { display: none; }
.hpwmap:not(:has(.hpwmap-bar)) .hpwmap-sheet { top: 12px; max-height: calc(100% - 24px); }
.hpwmap-sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, .85); color: var(--hpwmap-navy); box-shadow: 0 2px 8px rgba(5, 20, 62, .2);
}
.hpwmap-sheet-img { aspect-ratio: 16 / 9; background: var(--hpwmap-bg); overflow: hidden; border-radius: var(--hpwmap-radius) var(--hpwmap-radius) 0 0; }
.hpwmap-sheet-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hpwmap-sheet-body { padding: 14px 16px 16px; }
.hpwmap-sheet-chips { display: flex; flex-wrap: wrap; gap: 5px; padding-right: 36px; }
.hpwmap-sheet-img + .hpwmap-sheet-body .hpwmap-sheet-chips { padding-right: 0; }
.hpwmap-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--c, #05143E) 13%, #fff); color: color-mix(in srgb, var(--c, #05143E) 80%, #05143E);
}
.hpwmap-tag.is-former { background: var(--hpwmap-red); color: #fff; }
.hpwmap-tag.is-planned { background: var(--hpwmap-gold); color: var(--hpwmap-navy); }
.hpwmap-tag.is-years { background: rgba(5, 20, 62, .07); color: var(--hpwmap-navy); }
.hpwmap-sheet-title { margin: 8px 0 4px; font-family: "Francois One", sans-serif; font-weight: 400; font-size: 22px; line-height: 1.15; color: var(--hpwmap-navy); }
.hpwmap-sheet-teaser { margin: 0 0 10px; color: rgba(5, 20, 62, .78); font-size: 14.5px; }
.hpwmap-sheet-links { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.hpwmap-sheet-links a {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; color: var(--hpwmap-blue); text-decoration: none; font-weight: 600; font-size: 14px;
}
.hpwmap-sheet-links a:hover { background: rgba(0, 87, 168, .07); }
.hpwmap-sheet-cta {
  display: flex; justify-content: center; align-items: center; gap: 6px; padding: 11px 14px; border-radius: 999px; text-decoration: none;
  background: linear-gradient(135deg, var(--hpwmap-navy), var(--hpwmap-blue)); color: #fff !important; font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 87, 168, .3);
}
.hpwmap-sheet-cta:hover { box-shadow: 0 0 0 4px rgba(226, 166, 61, .35), 0 6px 16px rgba(0, 87, 168, .3); }

.hpwmap-openmap {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px;
  background: var(--hpwmap-navy); color: #fff !important; text-decoration: none; font-weight: 700; font-size: 14px; box-shadow: 0 6px 16px rgba(5, 20, 62, .3);
}
.hpwmap-openmap:hover { box-shadow: 0 0 0 4px rgba(226, 166, 61, .4), 0 6px 16px rgba(5, 20, 62, .3); }

/* Zeitreise: Karte leicht sepia */
.hpwmap.is-timetravel .hpwmap-canvas canvas { filter: sepia(.25) saturate(.85); }

/* MapLibre-Controls im HPW-Look */
.hpwmap .maplibregl-ctrl-group { border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(5, 20, 62, .18); background: var(--hpwmap-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.hpwmap .maplibregl-ctrl-group button { width: 38px; height: 38px; }
.hpwmap .maplibregl-ctrl-group button.hpwmap-fs { display: grid; place-items: center; color: var(--hpwmap-navy); }
.hpwmap .maplibregl-ctrl-attrib { font-size: 11px; background: rgba(255, 255, 255, .75); }
.hpwmap .maplibregl-ctrl-attrib a { color: var(--hpwmap-navy); }
.hpwmap .maplibregl-user-location-dot, .hpwmap .maplibregl-user-location-dot::before { background-color: var(--hpwmap-blue); }

/* ---------------- Schmale Karten / Handy ---------------- */
@container (max-width: 639px) {
  .hpwmap-search { max-width: none; }
  .hpwmap-btn span:not(.hpwmap-ico) { display: none; }
  .hpwmap-btn { width: 44px; padding: 0; justify-content: center; }
  .hpwmap-panel { left: 12px; right: 12px; width: auto; max-width: none; top: 64px; }
  .hpwmap-sheet {
    left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 62%;
    transform: translateY(24px);
  }
  .hpwmap-sheet-img { aspect-ratio: 21 / 9; }
  .hpwmap .maplibregl-ctrl-bottom-right { bottom: 0; }
  .hpwmap:has(.hpwmap-sheet.is-open) .maplibregl-ctrl-bottom-right { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hpwmap-sheet, .hpwmap-pin-dot, .hpwmap-pin-label, .hpwmap-arealabel { transition: none; }
}

/* ---------------- Ortsansicht ---------------- */
.hpwmap-place { --c: #05143E; }
.hpwmap-place-hero { position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 1.25rem; background: #F5F7FA; }
.hpwmap-place-hero img { display: block; width: 100%; max-height: 440px; object-fit: cover; }
.hpwmap-place-head { margin-bottom: 1rem; }
.hpwmap-place-head h1 { margin: .4rem 0 .3rem; }
.hpwmap-place-teaser { font-size: 1.1rem; color: rgba(5, 20, 62, .78); }
.hpwmap-place-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .hpwmap-place-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.hpwmap-place-aside > * + * { margin-top: 1rem; }
.hpwmap-place-maplink {
  display: inline-flex; align-items: center; gap: 7px; margin-top: .6rem; font-weight: 700; text-decoration: none;
}
.hpwmap-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: .5rem 0 1rem; }
.hpwmap-card {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid rgba(5, 20, 62, .1); box-shadow: 0 4px 14px rgba(5, 20, 62, .08); transition: transform .15s, box-shadow .15s;
}
.hpwmap-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 3px rgba(226, 166, 61, .35), 0 8px 20px rgba(5, 20, 62, .14); }
.hpwmap-card-img { aspect-ratio: 16 / 9; background: #F5F7FA center / cover no-repeat; }
.hpwmap-card-body { padding: 10px 12px 12px; }
.hpwmap-card-body small { display: block; color: rgba(5, 20, 62, .6); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.hpwmap-card-body strong { display: block; font-size: 15.5px; line-height: 1.25; margin-top: 2px; color: #05143E; }
.hpwmap-card-body p { margin: 6px 0 0; font-size: 13.5px; color: rgba(5, 20, 62, .7); }

/* Plugin-Überschrift */
.hpwmap-related { margin-top: 2rem; }
.hpwmap-related h2, .hpwmap-related h3 { margin-bottom: .6rem; }

/* ---------------- Legende ---------------- */
.hpwmap .maplibregl-ctrl-group button.hpwmap-legend-btn { display: grid; place-items: center; color: var(--hpwmap-navy); }
.hpwmap .maplibregl-ctrl-group button.hpwmap-legend-btn.is-active { background: var(--hpwmap-navy); color: #fff; }
.hpwmap-legend { top: auto; bottom: 12px; right: 60px; width: 290px; max-height: calc(100% - 24px); padding: 12px 14px; }
.hpwmap-legend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hpwmap-legend-head strong { font-family: "Francois One", sans-serif; font-weight: 400; font-size: 18px; letter-spacing: .02em; }
.hpwmap-legend-close { width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(5, 20, 62, .07); color: var(--hpwmap-navy); display: grid; place-items: center; cursor: pointer; }
.hpwmap-legend-sec + .hpwmap-legend-sec { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hpwmap-border); }
.hpwmap-legend-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgba(5, 20, 62, .55); margin-bottom: 6px; }
.hpwmap-legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.hpwmap-legend-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.2; }
.hpwmap-swatch { flex: 0 0 32px; display: inline-flex; }
.hpwmap-legend-pin {
  flex: 0 0 22px; width: 22px; height: 22px; margin: 0 5px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg);
  background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(5, 20, 62, .35); display: grid; place-items: center;
}
.hpwmap-legend-pin .fa { transform: rotate(45deg); color: #fff; font-size: 10px; }
.hpwmap-legend-pin.is-former { border-color: #F4DEDA; box-shadow: 0 0 0 1px rgba(92, 5, 0, .5), 0 1px 4px rgba(5, 20, 62, .35); }
.hpwmap-legend-pin.is-planned { border-color: var(--hpwmap-gold); }
.hpwmap-legend-note { margin: 10px 0 0; font-size: 11px; color: rgba(5, 20, 62, .5); }
.hpwmap:not(:has(.hpwmap-bar)) .hpwmap-legend { top: auto; }
@container (max-width: 639px) {
  .hpwmap-legend { left: 12px; right: 12px; width: auto; bottom: 12px; max-height: 70%; }
}
