/* De interactieve parkkaart op /map/ (templates/map.html, assets/js/parkmap.js).
 *
 * Alleen op de kaartpagina geladen. Zelfde regels als de rest van de site na
 * de rustronde van 2 okt 2026: bone als ondergrond, haarlijnen, hoek 12 pixel,
 * schaduw alleen op wat zweeft (legenda, kaartjes, tooltips, knoppen op de
 * kaart). Geen kapitalen met letterspatiëring, geen oker.
 *
 * Zonder JavaScript zet de pagina geen klasse pmgl-js op <html>. Dan is de
 * kaartdoos weg en staat de SVG-kaart er, met de lijst eronder. Op papier
 * altijd de SVG: een WebGL-canvas print vaak als leeg vlak.
 */

.pm-answer .doc-answer { max-width: calc(var(--measure) + 56px); margin-block: 26px 6px; }

.pmgl-section { position: relative; padding-block: 6px 0; }

/* ---------------------------------------------------------------- de doos */
.pmgl {
  position: relative; height: 70vh; min-height: 520px;
  border-radius: var(--radius); overflow: hidden;
  background: #F1EADA; border: 1px solid var(--hair);
  font-family: var(--font-ui);
}
.pmgl .pmgl-canvas { position: absolute; inset: 0; }
.pmgl-canvas:focus-visible { outline: 3px solid var(--terracotta); outline-offset: -3px; }

html:not(.pmgl-js) .pmgl,
html:not(.pmgl-js) .pmgl-skip { display: none; }
.pmgl-js .pmgl-static { display: none; }
/* Lukt het laden niet (geen WebGL, CDN geblokkeerd), dan de SVG alsnog. */
.pmgl-js .pmgl.is-failed { display: none; }
.pmgl-js .pmgl.is-failed ~ .pmgl-static { display: block; }

.pmgl-status {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
  color: var(--ink-soft); font-size: .95rem; pointer-events: none;
}
.pmgl.is-ready .pmgl-status { display: none; }

/* De statische kaart: nooit hoger dan het scherm, en de verhouding van de
   viewBox vast, zodat de SVG-doos en de tekening samenvallen. */
.pm-svgmap { margin: 0; }
.pm-svgmap .parkmap-svg {
  width: min(100%, calc(76vh * 1000 / 760)); aspect-ratio: 1000 / 760;
  height: auto; margin-inline: auto;
}
.pm-svgmap figcaption { font-size: .82rem; color: var(--ink-soft); margin-top: 8px; text-align: center; }

.pmgl-skip {
  position: absolute; left: -9999px; top: 18px; z-index: 20;
  background: #fff; color: var(--olive-800); padding: 9px 14px; border-radius: 8px;
  font-family: var(--font-ui); font-weight: 600; box-shadow: 0 4px 16px rgba(38,41,28,.18);
}
.pmgl-skip:focus { left: 40px; }

.pmgl-missing { margin: 12px 0 0; font-size: .9rem; color: var(--ink-soft); max-width: 90ch; }

/* ------------------------------------------------------------- de legenda */
.pmgl-legend {
  position: absolute; z-index: 3; top: 12px; left: 12px;
  width: 272px; max-height: calc(100% - 56px); overflow: auto;
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(38,41,28,.16);
  font-size: .9rem; color: var(--ink);
}
html:not(.pmgl-js) .pmgl-legend { display: none; }
.pmgl-legend-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px 9px 14px;
}
.pmgl-legend-h { margin: 0; font-size: 1rem; font-weight: 700; color: var(--olive-950); }
.pmgl-collapse {
  border: 0; background: none; padding: 4px 6px; margin: -4px -4px -4px 0; cursor: pointer;
  font: 600 .84rem var(--font-ui); color: var(--olive-800);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.pmgl-legend.is-collapsed { width: auto; }
.pmgl-legend.is-collapsed .pmgl-legend-body { display: none; }
.pmgl-legend-body { padding: 0 8px 8px; }
.pmgl-kinds { border: 0; margin: 0; padding: 0; min-width: 0; }
.pmgl-kind {
  display: grid; grid-template-columns: 18px 24px 1fr auto; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 8px; cursor: pointer; line-height: 1.25;
}
.pmgl-kind:hover { background: var(--panel); }
.pmgl-kind input { width: 16px; height: 16px; margin: 0; accent-color: var(--olive-800); cursor: pointer; }
.pmgl-kind input:not(:checked) ~ .pmgl-mk,
.pmgl-kind input:not(:checked) ~ .pmgl-lab { opacity: .45; }
.pmgl-mk { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; }
.pmgl-mk svg { display: block; max-width: 24px; max-height: 26px; width: auto; height: auto; }
.pmgl-mk-wide svg { max-height: 24px; }
.pmgl-n { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: .84rem; }
.pmgl-legend-note {
  display: flex; align-items: center; gap: 8px; margin: 4px 6px 2px 32px;
  font-size: .82rem; color: var(--ink-soft); line-height: 1.3;
}
.pmgl-legend-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 8px 0 0; padding: 10px 6px 2px; border-top: 1px solid var(--hair);
}
.pmgl-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; position: relative; }
.pmgl-switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.pmgl-switch-track {
  width: 36px; height: 20px; border-radius: 999px; background: rgba(38,41,28,.22);
  position: relative; transition: background .15s ease; flex: none;
}
.pmgl-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.pmgl-switch input:checked + .pmgl-switch-track { background: var(--olive-800); }
.pmgl-switch input:checked + .pmgl-switch-track::after { transform: translateX(16px); }
.pmgl-switch input:focus-visible + .pmgl-switch-track { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.pmgl-reset {
  border: 1px solid var(--hair-strong); background: #fff; border-radius: 8px;
  padding: 6px 11px; font: 600 .84rem var(--font-ui); color: var(--olive-950); cursor: pointer;
}
.pmgl-reset:hover { border-color: var(--olive-800); }

.pmgl-keybtn { display: none; }

/* --------------------------------------------------- kaartje en tooltip */
.pmgl-pop .maplibregl-popup-content {
  padding: 0; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 10px 30px rgba(38,41,28,.22); background: #fff;
}
.pmgl-pop .maplibregl-popup-close-button,
.pmgl-sheet-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.94); color: var(--ink); cursor: pointer;
  font: 400 22px/32px var(--font-ui); text-align: center; padding: 0;
  box-shadow: 0 1px 6px rgba(38,41,28,.2);
}
.pmgl-pop .maplibregl-popup-close-button:hover,
.pmgl-sheet-close:hover { background: #fff; color: var(--olive-950); }
.pmgl-card { font-family: var(--font-ui); color: var(--ink); width: 280px; max-width: 100%; }
.pmgl-card-img {
  display: block; width: 100%; aspect-ratio: 3 / 2; height: auto; object-fit: cover;
  background: var(--sand);
}
.pmgl-card-body { padding: 12px 16px 14px; }
.pmgl-card-name {
  margin: 0 36px 2px 0; font-family: var(--font-display); font-size: 1.08rem; line-height: 1.25;
  color: var(--olive-950);
}
.pmgl-card.has-img .pmgl-card-name { margin-right: 0; }
.pmgl-card-kind { margin: 0; font-size: .86rem; color: var(--ink-soft); line-height: 1.4; }
.pmgl-card-meta { margin: 6px 0 0; font-size: .9rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.pmgl-card-note { margin: 6px 0 0; font-family: var(--font-body); font-size: .9rem; line-height: 1.45; color: var(--ink); }
.pmgl-card-link {
  display: inline-block; margin-top: 10px; font-weight: 700; font-size: .92rem;
  color: var(--olive-800);
}

.pmgl-tip { pointer-events: none; }
.pmgl-tip .maplibregl-popup-content {
  padding: 6px 10px 7px; border-radius: 8px; background: #FFFDF7;
  box-shadow: 0 4px 14px rgba(38,41,28,.2); font-family: var(--font-ui); line-height: 1.3;
}
.pmgl-tip .maplibregl-popup-tip { border-top-color: #FFFDF7; border-bottom-color: #FFFDF7; }
.pmgl-tip-name { display: block; font-weight: 700; font-size: .9rem; color: var(--olive-950); }
.pmgl-tip-kind { display: block; font-size: .8rem; color: var(--ink-soft); }

/* De kaartknoppen van MapLibre, in onze vorm. */
.pmgl .maplibregl-ctrl-group { border-radius: 10px; box-shadow: 0 2px 10px rgba(38,41,28,.16); }
.pmgl .maplibregl-ctrl-group button { width: 34px; height: 34px; }
.pmgl .maplibregl-ctrl-scale {
  border-color: var(--ink); color: var(--ink); background: rgba(246,240,226,.85);
  font: 600 11px var(--font-ui);
}
.pmgl .maplibregl-ctrl-attrib { font-family: var(--font-ui); font-size: 11px; }
.pmgl .maplibregl-cooperative-gesture-screen { font-family: var(--font-ui); font-size: 1.05rem; }

.pmgl:fullscreen { height: 100vh; min-height: 0; border-radius: 0; border: 0; }
.pmgl:-webkit-full-screen { height: 100vh; min-height: 0; border-radius: 0; border: 0; }

/* De onderkaart op een telefoon: zelfde inhoud als het zwevende kaartje. */
.pmgl-sheet {
  position: absolute; z-index: 5; left: 8px; right: 8px; bottom: 8px;
  max-height: calc(100% - 16px); overflow: auto;
  background: #fff; border-radius: var(--radius); box-shadow: 0 8px 28px rgba(38,41,28,.25);
}
.pmgl-sheet[hidden] { display: none; }
.pmgl-sheet .pmgl-card { width: auto; display: grid; grid-template-columns: 38% 1fr; }
.pmgl-sheet .pmgl-card:not(.has-img) { display: block; }
.pmgl-sheet .pmgl-card-img { height: 100%; aspect-ratio: auto; min-height: 120px; }
.pmgl-sheet .pmgl-card-body { padding: 12px 14px 14px; }
.pmgl-sheet .pmgl-card-name { margin-right: 36px; }

@media (max-width: 720px) {
  .pmgl { height: 60vh; min-height: 400px; }
  .pmgl-keybtn {
    display: inline-flex; align-items: center; gap: 6px;
    position: absolute; z-index: 3; top: 10px; left: 10px;
    border: 0; border-radius: 999px; background: #fff; color: var(--olive-950);
    padding: 8px 14px; font: 700 .9rem var(--font-ui); cursor: pointer;
    box-shadow: 0 2px 10px rgba(38,41,28,.2);
  }
  /* De legenda wordt een vel dat van onderen inschuift. */
  .pmgl-legend {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 78%;
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translateY(105%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .pmgl.is-legend-open .pmgl-legend { transform: none; visibility: visible; transition: transform .2s ease; }
  .pmgl-legend.is-collapsed .pmgl-legend-body { display: block; }
  .pmgl-kind { padding: 8px 6px; }
  .pmgl .maplibregl-ctrl-scale { display: none; }
}

/* --------------------------------------------------- lijst onder de kaart */
.pm-places { padding-block: 40px 0; outline: none; scroll-margin-top: 84px; }
.pm-places > h2 { margin-bottom: 18px; }
.pm-places-grid { columns: 3 280px; column-gap: 44px; }
.pm-places-group { break-inside: avoid; margin: 0 0 28px; }
.pm-places-h {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-size: 1.05rem; color: var(--olive-950);
}
.pm-places-n { color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
.pm-places-pin {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ochre); color: var(--olive-950); font-size: .75rem; font-weight: 700;
  border: 2px solid var(--olive-950);
}
.pm-places-list { list-style: none; margin: 0; padding: 0; }
.pm-places-ol { counter-reset: pm; }
.pm-places-list li {
  padding: 6px 0; border-bottom: 1px solid var(--hair); line-height: 1.35; font-size: .95rem;
}
.pm-places-ol li { counter-increment: pm; padding-left: 28px; position: relative; }
.pm-places-ol li::before {
  content: counter(pm); position: absolute; left: 0; top: 6px;
  font-family: var(--font-ui); font-weight: 700; font-size: .85rem; color: var(--olive-800);
}
.pm-places-name { font-family: var(--font-ui); font-weight: 600; color: var(--olive-950); }
a.pm-places-name { color: var(--olive-800); }
.pm-places-note { display: block; font-size: .85rem; color: var(--ink-soft); }
.pm-places-approx { font-size: .82rem; color: var(--ink-soft); }
.pm-places-rest summary {
  cursor: pointer; padding: 7px 0 2px; font-family: var(--font-ui); font-weight: 600;
  font-size: .9rem; color: var(--olive-800);
}
.pm-places-rest[open] summary { margin-bottom: 2px; }
.pm-places-list li.pm-places-more { font-size: .85rem; color: var(--ink-soft); border-bottom: 0; }

@media print {
  .pmgl, .pmgl-skip { display: none !important; }
  .pmgl-static { display: block !important; }
  .pm-places-grid { columns: 2; }
}
