/* ============================================================
   Toolkit Map page — map + narrow right panel
   ============================================================ */

html {
  height: 100%;
}

body.toolkitmap {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--textfont), sans-serif;
  color: var(--grey);
  background: #fff;
}

body.toolkitmap a {
  color: var(--green);
}

body.toolkitmap a:focus-visible,
body.toolkitmap button:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
  border-radius: 3px;
}

.toolkitmap {
  --panel-bg: var(--paper, rgb(250, 250, 250));
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Header ---------- */

.toolkitmap-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1.25rem;
  background-color: #FFF;
  border-bottom: 2px solid var(--green);
}

.toolkitmap-suggest-btn {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border: 2px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-family: var(--titlefont), monospace;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.toolkitmap-suggest-btn:hover {
  background: color-mix(in srgb, var(--green) 82%, #000);
}

.toolkitmap-back {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--titlefont), monospace;
  font-size: 0.78rem;
  text-decoration-line: none;
}

.toolkitmap-back:hover {
  text-decoration-line: underline;
}

.toolkitmap-title {
  margin: 0;
  color: var(--grey);
  font-family: var(--titlefont), monospace;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green) !important;
}

/* ---------- Layout ---------- */

.toolkitmap-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 34%, 430px);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0; 
  overflow: hidden;
}

.toolkitmap-map-col {
  position: relative;
  min-height: 0;
  height: 100%;
  border-right: 2px solid var(--green);
}

/* ---------- Embed mode (?embed=1) — map + legend only, no header/panel ---------- */

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

.toolkitmap--embed .toolkitmap-map-col {
  border-right: 0;
}

.toolkitmap-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--yellow) 55%, #fff);
}

/* Basemap desaturation — neutral, no fixed hue: the actual brand tint comes
   from the ::after wash below, which follows --green/--yellow (data-color1/2) */
.toolkitmap-map .leaflet-tile-pane {
  filter: grayscale(0.55) saturate(0.72) brightness(1.06) contrast(0.92);
}

/* Soft brand wash sitting above the tiles but below markers/paths/popups */
.toolkitmap-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 250; /* tilePane 200 < 250 < overlayPane 400 */
  pointer-events: none;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--green) 20%, transparent),
    color-mix(in srgb, var(--yellow) 28%, transparent) 70%
  );
  mix-blend-mode: multiply;
}

/* Leaflet controls in brand colours */
.toolkitmap-map .leaflet-bar {
  border: 1px solid var(--green);
}

.toolkitmap-map .leaflet-bar a {
  color: var(--green);
  border-bottom-color: color-mix(in srgb, var(--green) 20%, transparent);
}

.toolkitmap-map .leaflet-bar a:hover {
  background: var(--yellow);
  color: var(--green);
}

.toolkitmap-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.82);
  font-size: 10px;
}

.toolkitmap-map .leaflet-control-attribution a {
  color: var(--green);
}

.toolkitmap-map .leaflet-popup-content-wrapper {
  border: 2px solid var(--yellow);
  border-radius: 8px;
}

/* ---------- Instructions bubble ---------- */

.toolkitmap-hint {
  position: absolute;
  z-index: 500;
  top: 1rem;
  right: 1rem;
  max-width: min(320px, calc(100% - 2rem));
  padding: 0.85rem 2rem 0.85rem 0.95rem;
  background: #fff;
  border: 1px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  line-height: 1.45;
}

.toolkitmap-hint[hidden] {
  display: none;
}

.toolkitmap-hint-body p {
  margin: 0;
}

.toolkitmap-hint-body p + p {
  margin-top: 0.5rem;
}

.toolkitmap-hint-close {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  border: 0;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--grey);
  cursor: pointer;
}

.toolkitmap-hint-open {
  position: absolute;
  z-index: 500;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--green);
  background: #fff;
  color: var(--green);
  font-family: var(--titlefont), monospace;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.toolkitmap-hint-open[hidden] {
  display: none;
}

/* ---------- Right panel ---------- */

.toolkitmap-content-col {
  min-height: 0;
  height: calc(100% - 50px);
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 2.2vw, 1.75rem);
  background: var(--panel-bg);
  scroll-behavior: smooth;
}

.toolkitmap-content-col[data-loading] {
  opacity: 0.45;
  transition: opacity 0.15s;
}

.marker-content-empty {
  color: color-mix(in srgb, var(--grey) 55%, transparent);
  font-style: italic;
  padding-top: 1rem;
}

/* ---------- Overview panel ---------- */

.mappanel-intro {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.mappanel-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mappanel-links li {
  margin: 0.2rem 0;
}

.mappanel-links a {
  display: inline-block;
  font-size: 0.9rem;
  text-decoration-line: none;
  border-bottom: 2px solid var(--yellow);
}

.mappanel-links a:hover {
  border-bottom-color: currentColor;
}

/* --- Category filters (also the map legend) --- */

.mappanel-reset {
  display: inline-block;
  margin-bottom: 0.85rem;
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-family: var(--titlefont), monospace;
  font-size: 0.78rem;
  cursor: pointer;
}

.mappanel-reset[hidden] {
  display: none;
}

.mapfilters {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.3;
}

.mapfilter {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.28rem 0.4rem;
  margin: 0 -0.4rem;
  border-radius: 5px;
  cursor: pointer;
}

.mapfilter:hover {
  background: color-mix(in srgb, var(--yellow) 18%, #fff);
}

.mapfilter:has(input:checked) {
  background: color-mix(in srgb, var(--yellow) 40%, #fff);
}

.mapfilter input {
  flex: 0 0 auto;
  margin: 0.12rem 0 0;
  accent-color: var(--green);
}

/* Theme pictogram: a Unicode character on a disc of the theme's colour.
   Without a character (category with no theme) it is a plain colour swatch. */
.mapicon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  color: #fff;
  font-family: var(--iconfont);
  font-size: 1.25em;
  font-weight: 400;
  line-height: 1;
}

/* The character redrawn as SVG, its ink centred on the disc (icon-center.js) */
.mapicon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mapicon:empty {
  width: 0.85rem;
  height: 0.85rem;
  margin-top: 0.1rem;
  border: 1px solid rgba(0, 0, 0, 0.25);
  font-size: inherit;
}

/* --- Theme cards: a theme with its finding, story and aim --- */

.maptheme {
  margin-bottom: 0.85rem;
  padding: 0.55rem 1rem 0.7rem;
  background: #fff;
  border: 1px solid var(--theme);
  border-radius: 8px;
}

.maptheme-heading {
  margin: 0 0 0.2rem;
  font-family: var(--titlefont), monospace;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.maptheme-heading .mapfilter {
  align-items: center;
}

.maptheme-heading .mapfilter input {
  margin-top: 0;
}

.maptheme-heading .mapfilter-count {
  font-family: var(--textfont), sans-serif;
  font-weight: 400;
}

.maptheme-row {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid color-mix(in srgb, var(--grey) 10%, transparent);
}

.maptheme-kind {
  margin: 0;
  font-family: var(--titlefont), monospace;
  font-size: 0.66rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--theme);
}

.maptheme .mapfilters {
  margin-top: 0.1rem;
}

.maptheme .mapfilter input {
  accent-color: var(--theme);
}

.mapfilter-label {
  flex: 1 1 auto;
}

.mapfilter-count {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--grey) 50%, transparent);
  font-variant-numeric: tabular-nums;
}

.mappanel-section .mappanel-links {
  margin-top: 0.6rem;
}

/* ---------- Marker card ---------- */

.marker-card-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--titlefont), monospace;
  font-size: 0.8rem;
  text-decoration-line: none;
}

.marker-card-back:hover {
  text-decoration-line: underline;
}

.marker-card-cover {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.marker-card-title {
  margin: 0 0 0.6rem;
  font-family: var(--titlefont), monospace;
  font-size: 1.35rem;
  line-height: 1.2;
}

.marker-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
}

.marker-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--grey) 16%, transparent);
  border-radius: 999px;
  font-size: 0.76rem;
  line-height: 1.3;
}

/* a tag that leads to its finding / story / aim in the toolkit */
body.toolkitmap a.marker-card-tag {
  color: inherit;
  text-decoration-line: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

body.toolkitmap a.marker-card-tag::after {
  content: "→";
  font-family: var(--titlefont), monospace;
  color: var(--tag, var(--green));
}

body.toolkitmap a.marker-card-tag:hover {
  border-color: var(--tag, var(--green));
  background: color-mix(in srgb, var(--tag, var(--green)) 10%, #fff);
}

.marker-card-tag .mapicon {
  margin-top: 0;
}

.marker-card-tag-group {
  font-family: var(--titlefont), monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--grey) 55%, transparent);
}

.marker-card-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.marker-card-desc p {
  margin: 0 0 0.6rem;
}

.marker-card-excerpt {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--yellow) 22%, #fff);
  border-left: 3px solid var(--yellow);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-line;
}

.marker-card-readmore {
  display: inline-block;
  font-family: var(--titlefont), monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration-line: none;
  border: 2px solid var(--green);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
}

.marker-card-readmore:hover {
  background: var(--green);
  color: #fff;
}

.marker-card-body {
  font-size: 0.95rem;
  line-height: 1.6;
}

.marker-card-body p {
  margin: 0 0 1rem;
}

.marker-card-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- Toolkit resource cards ---------- */

.toolcards {
  margin: 1.75rem 0 0.5rem;
}

.marker-card .toolcards {
  border-top: 2px solid var(--yellow);
  padding-top: 1.25rem;
}

.toolcards-heading {
  margin: 0 0 0.75rem;
  font-family: var(--titlefont), monospace;
  font-size: 0.95rem;
  font-weight: 700;
}

.toolcards-group[hidden] {
  display: none;
}

.toolcards-theme {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1rem 0 0.4rem;
  font-family: var(--titlefont), monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.toolcards-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0 calc(-1 * clamp(1rem, 2.2vw, 1.75rem));
  padding: 0.25rem clamp(1rem, 2.2vw, 1.75rem) 0.75rem;
/*  overflow-x: auto;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;*/
}

.toolcard {
  width: calc(50% - 1.5rem);
  /*flex: 0 0 12.5rem;*/
  /*scroll-snap-align: start;*/
}

.toolcard-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid var(--theme);
  border-radius: 8px;
  overflow: hidden;
  text-decoration-line: none;
  color: inherit;
}

a.toolcard-inner:hover {
  border-color: var(--theme, var(--green));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/*.toolcard-thumb {
  --tool-color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 5rem;
  background: var(--tool-color);
  color: #fff;
}

.toolcard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}*/

/*.toolcard-initials {
  font-family: var(--titlefont), monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}*/

.toolcard-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem 0.85rem;
}

.toolcard-body .mapicon {
  margin-bottom: 0.15rem;
  font-size: 1.15rem;
  display: none;
}

body.toolkitmap a.toolcard-inner .toolcard-name {
  color: var(--theme, var(--green));
}

.toolcard-name {
  font-family: var(--titlefont), monospace;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
}

a.toolcard-inner:hover .toolcard-name {
  text-decoration-line: underline;
}

.toolcard-meta {
  font-size: 0.76rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--grey) 75%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toolcard-users {
  font-size: 0.72rem;
  line-height: 1.35;
  color: color-mix(in srgb, var(--grey) 50%, transparent);
}

/* ---------- Marker pins ---------- */

.map-pin {
  background: none;
  border: 0;
}

.map-pin svg {
  display: block;
  color: #fff;
  font-family: var(--iconfont);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

/* ---------- Legend (embed mode only — elsewhere the filters live in the right panel) ---------- */

.toolkitmap-legend {
  position: absolute;
  z-index: 500;
  left: 0.75rem;
  bottom: 1.75rem;
  width: 230px;
  max-width: calc(100% - 1.5rem);
  background: #fff;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
}

.toolkitmap-legend-summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-family: var(--titlefont), monospace;
  font-weight: 700;
  list-style: none;
}

.toolkitmap-legend-summary::-webkit-details-marker {
  display: none;
}

.toolkitmap-legend-summary::after {
  content: " ▾";
  color: var(--green);
}

.toolkitmap-legend[open] .toolkitmap-legend-summary::after {
  content: " ▴";
}

.toolkitmap-legend-body {
  padding: 0 0.75rem 0.6rem;
  max-height: 40vh;
  overflow-y: auto;
}

.toolkitmap-legend-group {
  margin: 0.45rem 0 0;
  font-family: var(--titlefont), monospace;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--grey) 55%, transparent);
}

.toolkitmap-legend .mapfilters {
  margin-top: 0.15rem;
  font-size: inherit;
}

/* ---------- Leaflet popup ---------- */

.map-popup {
  font-family: var(--textfont), sans-serif;
}

.map-popup-cover {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
  border-radius: 3px;
}

.map-popup-title {
  font-family: var(--titlefont), monospace;
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.map-popup-desc {
  font-size: 0.9rem;
  line-height: 1.45;
}

.map-popup-desc p {
  margin: 0 0 0.4rem;
}

.leaflet-popup-content {
  margin: 0.85rem 1rem;
}

/* ---------- "Suggest a place" popup ---------- */

.mapsuggest-popup {
  position: absolute;
  z-index: 600; /* above the hint bubble */
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  background: #fff;
  border: 2px solid var(--green);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.mapsuggest-popup[hidden] {
  display: none;
}

.mapsuggest-popup-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--grey);
  cursor: pointer;
}

.mapsuggest-popup-title {
  margin: 0 1.5rem 0.75rem 0;
  font-family: var(--titlefont), monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--grey);
}

.mapsuggest-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.mapsuggest-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.mapsuggest-form input[type="text"],
.mapsuggest-form input[type="email"],
.mapsuggest-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--grey) 30%, transparent);
  border-radius: 5px;
  background: #fff;
}

.mapsuggest-form input:focus,
.mapsuggest-form textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 0;
  border-color: var(--green);
}

.mapsuggest-form textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.mapsuggest-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mapsuggest-pick {
  align-self: flex-start;
  font-family: var(--titlefont), monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  cursor: pointer;
}

.mapsuggest-pick.is-armed {
  background: var(--green);
  color: #fff;
}

.mapsuggest-coords {
  font-family: var(--titlefont), monospace;
  font-size: 0.75rem;
  font-weight: 400;
  color: color-mix(in srgb, var(--grey) 60%, transparent);
}

.mapsuggest-submit {
  align-self: flex-start;
  font-family: var(--titlefont), monospace;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

.mapsuggest-note {
  font-size: 0.75rem;
  font-weight: 400;
  color: color-mix(in srgb, var(--grey) 60%, transparent);
  margin: 0;
}

.mapsuggest-msg {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.mapsuggest-msg--ok {
  background: color-mix(in srgb, var(--green) 15%, #fff);
  border-left: 3px solid var(--green);
}

.mapsuggest-msg--error {
  background: #fde8e8;
  border-left: 3px solid #c0392b;
}

.mapsuggest-msg ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .toolkitmap-layout {
    grid-template-columns: 1fr;
    /*grid-template-rows: 52vh 1fr;*/
  }

  .toolkitmap-map-col {
    border-right: 0;
    border-bottom: 2px solid var(--green);
  }

  .toolkitmap-content-col {
    border-left: 0;
  }

  .toolkitmap-legend {
    left: 0.5rem;
    bottom: 0.75rem;
    width: 190px;
    font-size: 0.78rem;
  }

  .toolkitmap-legend-body {
    max-height: 30vh;
  }

  .toolkitmap-header {
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
  }

  .mapsuggest-popup {
    width: calc(100% - 1.5rem);
    max-height: calc(100% - 1.5rem);
  }
}
