/* Final dealer map v2 (FINL-01). Paper register: white ground, Delft Blue ink, 1 px hairlines,
   no rounded corners, no shadows. Colours derive from the design-system tokens when present. */

/* Without JavaScript the container stays empty and takes no space. */
.dealer-map:empty,
[data-dealer-map]:empty { display: none; }

.fdm2 {
  --fdm-ink: var(--fnl-delft, #131E29);
  --fdm-ground: var(--fnl-white, #FFFFFF);
  --fdm-muted: var(--fnl-delft-72, rgb(19 30 41 / 0.72));
  --fdm-line: var(--fnl-delft-16, rgb(19 30 41 / 0.16));
  --fdm-soft: var(--fnl-delft-08, rgb(19 30 41 / 0.08));
  --fdm-land: #F8F9FA;
  --fdm-land: color-mix(in srgb, var(--fdm-ink) 2.5%, var(--fdm-ground));
  --fdm-ease: var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  container-type: inline-size;
  color: var(--fdm-ink);
  font-family: var(--font-sans, inherit);
  font-weight: 400;
  line-height: 1.5;
}
.fdm2 *, .fdm2 *::before, .fdm2 *::after { box-sizing: border-box; }
.fdm2 [hidden] { display: none !important; }

/* Stage ---------------------------------------------------------------------------------------- */
.fdm2-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--fdm-land);
  border-top: 1px solid var(--fdm-line);
  -webkit-tap-highlight-color: transparent;
}
.fdm2 .fdm2-canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s var(--fdm-ease);
}
.fdm2[data-state="ready"] .fdm2-canvas { opacity: 1; }
.fdm2-canvas .maplibregl-canvas { outline: none; }
/* Keyboard focus on the map: a hairline inside the frame. */
.fdm2-stage:has(.maplibregl-canvas:focus-visible)::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--fdm-ink);
  pointer-events: none;
  z-index: 3;
}

/* Zoom buttons: two hairline squares, top right. */
.fdm2-zoom {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--fdm-ground);
  border: 1px solid var(--fdm-line);
  opacity: 0;
  transition: opacity 0.5s var(--fdm-ease);
}
.fdm2[data-state="ready"] .fdm2-zoom { opacity: 1; }
.fdm2-zoom-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--fdm-ink);
  cursor: pointer;
  transition: background-color 0.2s var(--fdm-ease);
}
.fdm2-zoom-btn + .fdm2-zoom-btn { border-top: 1px solid var(--fdm-line); }
.fdm2-zoom-btn:hover:not(:disabled) { background: var(--fdm-soft); }
.fdm2-zoom-btn:disabled { color: var(--fdm-line); cursor: default; }
.fdm2-zoom-btn:focus-visible { outline: 1px solid var(--fdm-ink); outline-offset: 2px; }

/* Attribution: one quiet line, required by the OpenStreetMap licence. */
.fdm2-attrib {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 3px 8px 4px;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  background: rgb(255 255 255 / 0.78);
}
.fdm2-attrib a {
  color: var(--fdm-muted);
  text-decoration: none;
}
.fdm2-attrib a:hover { color: var(--fdm-ink); text-decoration: underline; text-underline-offset: 3px; }
.fdm2-attrib a:focus-visible { outline: 1px solid var(--fdm-ink); outline-offset: 1px; }

/* Gesture hint: replaces the built-in overlay with one calm line. */
.fdm2-gesture {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  margin: 0;
  padding: 10px 16px 11px;
  transform: translate(-50%, -50%);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--fdm-ground);
  background: var(--fdm-ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--fdm-ease), visibility 0s 0.25s;
}
.fdm2-gesture.is-on { opacity: 0.92; visibility: visible; transition: opacity 0.2s var(--fdm-ease), visibility 0s; }
.fdm2 .maplibregl-cooperative-gesture-screen { display: none !important; }

/* Map label: name and town of one partner, a white tab with a hairline. The marker element is a 0 x 0 anchor. */
.fdm2-label { width: 0; height: 0; pointer-events: none; z-index: 2; }
.fdm2-label-tab {
  position: absolute;
  font-family: var(--font-sans, inherit);
  left: 13px;
  top: 0;
  display: none;
  align-items: baseline;
  gap: 8px;
  padding: 5px 9px 6px;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--fdm-ink);
  background: var(--fdm-ground);
  border: 1px solid var(--fdm-line);
}
.fdm2-label.is-on .fdm2-label-tab { display: flex; animation: fdm2-in 0.2s var(--fdm-ease); }
.fdm2-label.is-selected .fdm2-label-tab { left: 18px; }
.fdm2-label.is-flipped .fdm2-label-tab { left: auto; right: 13px; }
.fdm2-label.is-flipped.is-selected .fdm2-label-tab { right: 18px; }
.fdm2-label small { font-size: inherit; color: var(--fdm-muted); }
.fdm2[data-moving] .fdm2-label:not(.is-selected) { visibility: hidden; }
@keyframes fdm2-in { from { opacity: 0; } to { opacity: 1; } }

/* Bar under the map: legend and actions --------------------------------------------------------- */
.fdm2-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  min-height: 52px;
  border-top: 1px solid var(--fdm-line);
}
.fdm2-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--fdm-muted);
}
.fdm2-legend span { display: inline-flex; align-items: center; gap: 9px; }
.fdm2-key {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fdm-ink);
}
.fdm2-key.is-ring { width: 8px; height: 8px; background: transparent; border: 1.5px solid var(--fdm-ink); }
.fdm2-key.is-you { width: 9px; height: 9px; border-radius: 0; background: var(--fdm-ground); border: 1px solid var(--fdm-ink); box-shadow: inset 0 0 0 2px var(--fdm-ground), inset 0 0 0 5px var(--fnl-charcoal, #3C4142); }
.fdm2-actions { display: flex; align-items: center; gap: 4px 28px; margin-left: auto; flex-wrap: wrap; }
.fdm2-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fdm-ink);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.fdm2-action svg { flex: none; transition: transform 0.35s var(--fdm-ease); }
.fdm2-back:hover svg { transform: translateX(-3px); }
.fdm2-locate span { text-decoration: underline; text-decoration-color: var(--fdm-line); text-decoration-thickness: 1px; text-underline-offset: 5px; transition: text-decoration-color 0.2s; }
.fdm2-locate:hover span { text-decoration-color: currentColor; }
.fdm2-locate[aria-busy="true"] { cursor: progress; color: var(--fdm-muted); }
.fdm2-locate[aria-busy="true"] svg { animation: fdm2-pulse 1.2s ease-in-out infinite; }
@keyframes fdm2-pulse { 50% { opacity: 0.35; } }
.fdm2-action:focus-visible,
.fdm2-textbtn:focus-visible { outline: 1px solid var(--fdm-ink); outline-offset: 4px; }

/* Location note --------------------------------------------------------------------------------- */
.fdm2-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 20px;
  padding: 0 0 14px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fdm-muted);
}
.fdm2-note p { margin: 0; max-width: 46em; }
.fdm2-note p.is-error { color: var(--fdm-ink); }
.fdm2-note p.is-error::before { content: ""; display: inline-block; width: 12px; height: 1px; margin: 0 8px 3px 0; background: currentColor; }
.fdm2-textbtn {
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fdm-ink);
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-decoration-color: var(--fdm-line);
  text-underline-offset: 4px;
  cursor: pointer;
}
.fdm2-textbtn:hover { text-decoration-color: currentColor; }

/* Panel: list of partners and the card ---------------------------------------------------------- */
.fdm2-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas: "list card";
  gap: 0 48px;
  align-items: start;
  border-top: 1px solid var(--fdm-line);
  padding-top: 22px;
}
.fdm2-listbox { grid-area: list; }
.fdm2-card { grid-area: card; }
.fdm2-listhead {
  margin: 0 0 6px;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: var(--tracking-header, 0.2em);
  text-transform: uppercase;
  color: var(--fdm-muted);
}
.fdm2-list { list-style: none; margin: 0; padding: 0; }
.fdm2-list li { border-bottom: 1px solid var(--fdm-line); }
.fdm2-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--fdm-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: padding 0.3s var(--fdm-ease), background-color 0.2s var(--fdm-ease);
}
.fdm2-row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fdm2-row-name { font-size: 15px; line-height: 1.3; }
.fdm2-row-meta { font-size: 12px; line-height: 1.4; color: var(--fdm-muted); }
.fdm2-row.is-country { justify-content: space-between; }
.fdm2-row.is-country .fdm2-row-name { flex: 1; }
.fdm2-row.is-country .fdm2-row-meta { margin-left: auto; }
.fdm2-row.is-country svg { flex: none; color: var(--fdm-muted); transition: transform 0.35s var(--fdm-ease), color 0.2s; }
.fdm2-row-dist { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--fdm-muted); }
.fdm2-row:hover, .fdm2-row.is-hover { padding-left: 6px; }
.fdm2-row.is-country:hover svg { transform: translateX(3px); color: var(--fdm-ink); }
.fdm2-row:focus-visible { outline: 1px solid var(--fdm-ink); outline-offset: -1px; padding-left: 10px; }
.fdm2-row[aria-pressed="true"] { padding-left: 10px; }
.fdm2-row[aria-pressed="true"] .fdm2-key { transform: scale(1.35); }
.fdm2-row[aria-pressed="true"]::before {
  content: "";
  align-self: stretch;
  width: 1px;
  margin: -8px 0 -8px -10px;
  background: var(--fdm-ink);
}
.fdm2-row > .fdm2-key { margin: 0 0.5px; }
.fdm2-row > .fdm2-key.is-ring { margin: 0; }
.fdm2-row .fdm2-key { transition: transform 0.3s var(--fdm-ease); }
.fdm2-more { margin-top: 8px; }

.fdm2-card { min-height: 120px; }
.fdm2-card p { margin: 0; }
.fdm2-card-summary {
  max-width: 30em;
  padding-top: 20px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--fdm-muted);
}
.fdm2-card-meta {
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: var(--tracking-header, 0.2em);
  text-transform: uppercase;
  color: var(--fdm-muted);
  margin-bottom: 14px !important;
}
.fdm2-card-name {
  font-size: 28px;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.fdm2-card-body { padding-top: 22px; }
.fdm2-card-address { font-size: 15px; line-height: 1.6; }
.fdm2-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 28px;
  margin-top: 4px !important;
  font-size: 14px;
}
.fdm2-card-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--fdm-ink);
  text-decoration: underline;
  text-decoration-color: var(--fdm-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s;
}
.fdm2-card-links a:hover { text-decoration-color: currentColor; }
.fdm2-card-links a:focus-visible { outline: 1px solid var(--fdm-ink); outline-offset: 2px; }
.fdm2-card-links svg { flex: none; }

/* Without WebGL: no map, the list and the card still work. */
.fdm2[data-state="nomap"] .fdm2-bar { border-top: 0; }

.fdm2-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Small widths: a squarer map, the card above the list. */
@container (max-width: 640px) {
  .fdm2-stage { aspect-ratio: 1 / 1; }
  .fdm2-panel { grid-template-columns: 1fr; grid-template-areas: "card" "list"; padding-top: 18px; }
  .fdm2-card { min-height: 0; padding-bottom: 26px; }
  .fdm2-card.is-empty { padding-bottom: 18px; }
  .fdm2-card-summary { padding-top: 0; font-size: 14px; }
  .fdm2-card-name { font-size: 24px; }
  .fdm2-card-body { padding-top: 12px; }
  .fdm2-zoom { top: 10px; right: 10px; }
}
@container (min-width: 641px) and (max-width: 860px) {
  .fdm2-stage { aspect-ratio: 4 / 3; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 680px) {
    .fdm2-stage { aspect-ratio: 1 / 1; }
    .fdm2-panel { grid-template-columns: 1fr; grid-template-areas: "card" "list"; }
  }
}

/* Reduced motion: the site toggle (html.motion-reduced) and the system setting. */
.motion-reduced .fdm2 *,
.motion-reduced .fdm2 *::before,
.motion-reduced .fdm2 *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .fdm2 *, .fdm2 *::before, .fdm2 *::after { transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .fdm2-key { background: ButtonText; forced-color-adjust: none; }
  .fdm2-row[aria-pressed="true"]::before { background: Highlight; }
}
