/* PhotoMap: every selector is prefixed .pm- (no global body/h1/a rules)
   so the component can be embedded in a third-party page (e.g. the Memobase Drupal theme).
   The font is inherited from the host page. */

.pm-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  overflow: hidden;
  overflow: clip;       /* clip, not hidden: focus or floating cards must never scroll the component */
  font-family: inherit;
  font-size: 14px;
  color: #111;
  container-type: inline-size; /* "small screen" rules follow the component's size, not the window's */
}
.pm-root *, .pm-root *::before, .pm-root *::after { box-sizing: border-box; }
.pm-map { position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity 1.2s ease; }
.pm-ready .pm-map { opacity: 1; }
.pm-map-hist { transition: none; }   /* own stacking context: map controls stay under the gallery */

/* ---------- titre + filtres (haut gauche) ---------- */
.pm-top {
  position: absolute;
  top: 16px; left: 20px;
  max-width: calc(50% - 150px);    /* stay left of the Map / Swipe / Gallery tabs (centred) */
  pointer-events: none;            /* the map stays clickable around the text */
}
.pm-top > * { pointer-events: auto; }
.pm-title {
  font-size: clamp(22px, 4.5cqw, 42px);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 0 6px #fff, 0 0 14px #fff;
}
.pm-subtitle {
  margin-top: 4px;
  font-size: clamp(13px, 2cqw, 18px);
  text-shadow: 0 0 6px #fff, 0 0 12px #fff;
}
.pm-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
/* one chip look for the theme tabs, the undated toggle and the legend entries */
.pm-themetab, .pm-pill, .pm-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1.5px solid #000; border-radius: 999px;
  background: rgba(255, 255, 255, 0.8); color: #000;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);   /* frosted glass over the map */
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1.3;
  user-select: none;
}
.pm-themetab, .pm-pill, .pm-legend-item { cursor: pointer; }
.pm-themetab:hover, .pm-pill:hover, .pm-legend-item:hover { background: #f0efea; }
.pm-themetab[aria-selected="true"], .pm-legend-item[aria-pressed="true"], .pm-pill:has(input:checked) { background: #000; color: #fff; }
.pm-themetab:focus-visible, .pm-legend-item:focus-visible, .pm-pill:focus-within { outline: 2px solid #000; outline-offset: 2px; }
.pm-pill input { accent-color: #fff; margin: 0; width: 13px; height: 13px; }
/* theme tabs: toggle several, "All" resets; they share the .pm-filters row */
.pm-themes { display: contents; }
/* "All" folds the theme list away; its arrow shows the state */
.pm-themes-closed .pm-themetab:not([data-theme=""]) { display: none; }
.pm-themetab[data-theme=""]::after {
  content: ""; width: 6px; height: 6px; margin: 0 2px 0 4px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(135deg);     /* points left: click to fold */
  transition: transform 0.2s;
}
.pm-themes-closed .pm-themetab[data-theme=""]::after { transform: rotate(-45deg); }   /* points right: click to unfold */
.pm-themetab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pm-themen { font-size: 10px; font-weight: 500; opacity: 0.6; }

/* legend: same chips; each one also toggles its place type */
.pm-legend {
  position: absolute; left: 20px; bottom: 28px;   /* bottom left corner, above the credit line */
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.pm-dot {   /* legend swatch: a ring like the photo previews on the map */
  display: inline-block; width: 16px; height: 16px; flex: none;
  box-sizing: border-box; border: 3px solid var(--pm-accent, #89CFF0); border-radius: 50%;
  background: #ddd;
}
.pm-dot-taken { border-style: dashed; }

/* ---------- year slider (bottom) ---------- */
.pm-timeline {
  position: absolute;
  left: 50%; bottom: 34px;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 32px));
  display: flex; align-items: center; gap: 10px;
}
.pm-year {
  padding: 8px 14px;
  border-radius: 999px;
  background: #000; color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pm-double { position: relative; flex: 1; height: 28px; }
.pm-double::before {                 /* one rail shared by both handles */
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  background: #000;
}
/* two sliders stacked on top of each other; only the handles take pointer events */
.pm-double input[type=range] {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 28px; margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.pm-double input[type=range]::-webkit-slider-runnable-track { background: none; }
.pm-double input[type=range]::-moz-range-track { background: none; }
.pm-double input[type=range]::-webkit-slider-thumb {
  pointer-events: auto; -webkit-appearance: none;
  width: 22px; height: 22px;
  border: 4px solid #000; border-radius: 50%;
  background: #fff; cursor: pointer;
}
.pm-double input[type=range]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px; height: 14px;
  border: 4px solid #000; border-radius: 50%;
  background: #fff; cursor: pointer;
}

/* ---------- info panel (right) ---------- */
.pm-panel {
  position: absolute;
  top: 100px; right: 16px; bottom: 84px;
  width: 340px; max-width: calc(100% - 32px);
  padding: 18px;
  overflow-y: auto;
  border-radius: 14px;
  background: radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--pm-accent, #89CFF0) 45%, #fff) 0%, rgba(255, 255, 255, 0) 60%), #fff;   /* accent glow in the top corner */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  transform: translateX(120%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0.2s;
}
.pm-panel.pm-open { transform: none; visibility: visible; }
.pm-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none;
  font-size: 22px; line-height: 1; cursor: pointer; color: #111;
}
.pm-h3 { margin: 0 24px 12px 0; font-size: 17px; font-weight: 700; line-height: 1.25; }
.pm-image {
  margin-bottom: 8px; min-height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: #eee;
}
.pm-image img { display: block; max-width: 100%; }
.pm-loading { padding: 12px; font-size: 12px; color: #666; text-align: center; }
.pm-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.pm-table td { padding: 4px 0; vertical-align: top; }
.pm-table td.pm-label { width: 110px; padding-right: 8px; font-weight: 700; }
.pm-coord { font-size: 11px; color: #777; }
.pm-root a { color: inherit; text-decoration: underline; }
/* several photos on one spot: one entry each, stacked in the panel */
.pm-spot { margin: -6px 24px 12px 0; font-size: 13px; color: #666; }
.pm-entry { padding: 14px 0; border-top: 1px solid #ddd; }
.pm-entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; }
.pm-date { flex: none; font-size: 12px; color: #666; }
.pm-desc { margin-top: 2px; font-size: 13px; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.pm-chip { padding: 2px 9px; border-radius: 999px; background: #000; color: #fff; font-size: 11px; font-weight: 600; }
.pm-entry a { font-size: 13px; }

/* ---------- mentions ---------- */
.pm-credit {
  position: absolute; left: 20px; bottom: 6px;
  max-width: calc(100% - 160px);
  font-size: 10px; color: #333;
  text-shadow: 0 0 4px #fff, 0 0 8px #fff;
}

/* ---------- small preview of a single photo, shown when zoomed in far (DOM marker) ---------- */
.pm-thumb {
  width: 52px; height: 52px; padding: 0;
  border: 3px solid var(--pm-accent, #89CFF0); border-radius: 50%;   /* dashed = shooting place, solid = shown place */
  background: #eee; overflow: hidden; cursor: pointer;
  box-shadow: 0 0 24px 8px color-mix(in srgb, var(--pm-accent, #89CFF0) 50%, transparent),
              0 4px 12px rgba(0, 0, 0, 0.3);   /* soft accent glow */
  animation: pm-fade 0.45s ease-out;                            /* not transform: MapLibre positions markers with it */
  transition: box-shadow 0.2s;
}
.pm-thumb-taken { border-style: dashed; }
.pm-thumb:hover { box-shadow: 0 0 30px 12px color-mix(in srgb, var(--pm-accent, #89CFF0) 65%, transparent),
              0 6px 18px rgba(0, 0, 0, 0.45); }
.pm-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.pm-thumb:hover img { transform: scale(1.15); }
@keyframes pm-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pm-thumb, .pm-thumb img { animation: none; transition: none; } }
.pm-thumb-sel { outline: 3px solid #000; outline-offset: 1px; }
.pm-thumb-none { width: 18px; height: 18px; border-radius: 50%; background: #fff; }  /* image missing: plain dot */
.pm-thumb-none img { display: none; }

/* ---------- Map / Swipe tabs (top centre) ---------- */
.pm-modes {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; padding: 3px;
  border: 2px solid #000; border-radius: 999px;
  background: #fff;
}
.pm-modes button {
  padding: 7px 18px;
  border: 0; border-radius: 999px;
  background: none; color: #111;
  font: inherit; font-weight: 600; cursor: pointer;
}
.pm-modes button.pm-active { background: #000; color: #fff; }

/* ---------- swipe mode: two maps, the top one (.pm-map) is clipped at the divider ---------- */
.pm-root { --pm-split: 50%; }
.pm-map-hist { position: absolute; inset: 0; display: none; }
.pm-compare .pm-map-hist { display: block; }
.pm-compare .pm-map { clip-path: inset(0 0 0 var(--pm-split)); }
.pm-divider {
  display: none;
  position: absolute; top: 0; bottom: 0;
  left: var(--pm-split);
  width: 24px; margin-left: -12px;
  cursor: ew-resize; touch-action: none;
}
.pm-compare .pm-divider { display: block; }
.pm-divider::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 11px;
  width: 2px; background: #000;
}
.pm-handle {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #000; color: #fff;
  font-size: 9px; white-space: nowrap;
}

/* year pickers: only in swipe mode (the timeline slider stays visible) */
.pm-step { display: none; }
.pm-compare .pm-legend { display: none; }
.pm-compare .pm-step { display: block; }
.pm-compare .pm-step-left { display: inline-block; margin-top: 14px; } /* inside .pm-top, under the title */
.pm-step-right { position: absolute; top: 16px; right: 20px; }
.pm-step-label {
  display: block; margin: 0 0 3px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  text-shadow: 0 0 4px #fff, 0 0 8px #fff;
}
.pm-step-box {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 8px;
  border: 2px solid #000; border-radius: 999px;
  background: #fff;
}
.pm-step-box button {
  padding: 4px 6px;
  border: 0; background: none; color: inherit;
  font-size: 11px; cursor: pointer;
}
.pm-step-select {
  width: 76px; padding: 4px 0;
  border: 0; background: none; color: inherit;
  font: inherit; font-weight: 700; text-align: center; text-align-last: center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}

/* ---------- gallery mode: floating photo cards on a plain canvas (covers the map) ---------- */
.pm-gallery { display: none; position: absolute; inset: 0; z-index: 0; overflow: hidden; overflow: clip; background: #f4f3ef; }  /* clip: cannot be scrolled by focus */  /* z-index: card stacking stays inside */
.pm-gallery-on .pm-gallery { display: block; }
.pm-gallery-on .pm-legend, .pm-gallery-on .pm-credit { display: none; }
.pm-gcanvas { position: absolute; inset: 0; }
.pm-card {
  position: absolute; left: 0; top: 0;
  padding: 0; border: 0; background: none; cursor: pointer;
  transition: transform 1.2s cubic-bezier(0.22, 0.75, 0.2, 1), opacity 0.4s;
  will-change: transform;
}
.pm-card img {
  display: block; width: 100%;
  aspect-ratio: 4 / 3; object-fit: cover;
  border: 4px solid #fff; border-radius: 3px;
  background: #ddd;
  box-shadow: 0 5px 15px rgba(35, 58, 53, 0.15);
  animation: pm-float 6s ease-in-out infinite alternate;
}
.pm-card:hover { z-index: 1000 !important; }
.pm-card:hover img { animation-play-state: paused; }
.pm-card-sel img { outline: 3px solid #000; outline-offset: 1px; }
.pm-card-off { opacity: 0; pointer-events: none; }
.pm-glabel {
  position: absolute; transform: translate(-50%, -50%);
  border: 0; color: inherit; font-family: inherit;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(244, 243, 239, 0.87);
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap;
  z-index: 1001;
}
.pm-gcount {
  display: inline-block; margin-left: 8px; padding: 0 7px;
  border-radius: 999px; background: #000; color: #fff;
  font-size: 11px; letter-spacing: 0; line-height: 18px;
}
button.pm-glabel { cursor: pointer; }
button.pm-glabel:hover { background: #000; color: #fff; }
button.pm-glabel:hover .pm-gcount { background: #fff; color: #000; }
span.pm-glabel { pointer-events: none; }
@keyframes pm-float {
  from { translate: 0 -4px; rotate: -1deg; }
  to { translate: 2px 5px; rotate: 1deg; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-card { transition: none; }
  .pm-card img { animation: none; }
}
/* "back to all groups" button, only while one group is open */
.pm-gback {
  display: none; position: absolute; top: 64px; right: 20px;
  padding: 7px 16px; border: 2px solid #000; border-radius: 999px;
  background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer;
}
.pm-gfocus .pm-gback { display: block; }
.pm-gback, .pm-arrange { z-index: 1002; }   /* above the cards (inline z-index up to ~1000) and group labels */
/* arrangement buttons (top right, where the swipe year picker sits) */
.pm-arrange {
  position: absolute; top: 16px; right: 20px;
  display: flex; padding: 3px;
  border: 2px solid #000; border-radius: 999px;
  background: #fff;
}
.pm-arrange button {
  padding: 7px 14px;
  border: 0; border-radius: 999px;
  background: none; color: #111;
  font: inherit; font-weight: 600; cursor: pointer;
}
.pm-arrange button[aria-pressed="true"] { background: #000; color: #fff; }

/* legend would hit the timeline's year pill: lift it above the slider */
@container (max-width: 1240px) { .pm-legend { bottom: 84px; } }

/* ---------- small component: the panel becomes a bottom sheet ---------- */
@container (max-width: 700px) {
  .pm-top { left: 12px; top: 64px; max-width: calc(100% - 80px); }
  .pm-modes { left: 12px; transform: none; }
  .pm-panel {
    top: auto; left: 8px; right: 8px; bottom: 84px;
    width: auto; max-width: none; max-height: 45%;
    transform: translateY(130%);
  }
  .pm-step-right { right: 12px; }
  .pm-gback { top: 16px; right: 12px; }  /* the bottom is taken by the switcher and the sheet */
  .pm-gallery-on .pm-panel { bottom: 142px; max-height: 40%; }  /* sheet stays above the arrangement switcher */
  .pm-arrange { top: auto; bottom: 78px; left: 50%; right: auto; transform: translateX(-50%); }  /* no room at the top */
  .pm-legend { display: none; }
  /* zoom buttons would sit on the timeline here: lift them above it */
  .pm-root .maplibregl-ctrl-bottom-right { bottom: 70px; }
}

/* ---------- zoom buttons: bare thin + / - without a box ---------- */
.pm-root .maplibregl-ctrl-group { background: none; box-shadow: none; border-radius: 0; }
.pm-root .maplibregl-ctrl-group button { width: 44px; height: 44px; background-color: transparent; }
.pm-root .maplibregl-ctrl-group button + button { border-top: 0; }
.pm-root .maplibregl-ctrl-group button:hover { background-color: transparent; }
.pm-root .maplibregl-ctrl-icon { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px #fff); background-size: 44px 44px; }
.pm-root .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Cpath d='M8 22h28M22 8v28' stroke='%23000' stroke-width='2.5'/%3E%3C/svg%3E"); }
.pm-root .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Cpath d='M8 22h28' stroke='%23000' stroke-width='2.5'/%3E%3C/svg%3E"); }
