/* =========================================================
   Locations Map
   ========================================================= */
.cl-locmap { background: #fff; }

.cl-locmap__head {
  text-align: center;
  margin-bottom: 34px;
  max-width: 600px !important;
}
.cl-locmap__heading { color: var(--cl-purple); margin: 0 0 14px; }
.cl-locmap__sub { color: var(--cl-text); margin: 0 auto; max-width: 640px; }

/* ---------- Map + panel ---------- */
.cl-locmap__stage {
  position: relative;
  height: var(--cl-locmap-h, 700px);
}
.cl-locmap__canvas {
  position: absolute;
  inset: 0;
  border-radius: var(--cl-locmap-radius, 0);
  overflow: hidden;
}
.cl-locmap__canvas .leaflet-container { height: 100%; }

/* The list floats over the map. */
.cl-locmap__panel {
  position: absolute;
  top: 34px;
  left: max(24px, calc((100% - var(--cl-container)) / 2 + var(--cl-gutter)));
  width: 390px;
  max-width: calc(100% - 40px);
  max-height: calc(100% - 68px);
  display: flex;
  flex-direction: column;
  background: #F5F5F8;
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(22, 4, 66, 0.18);
  z-index: 500;
  overflow: hidden;
}
.cl-locmap__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
}
.cl-locmap__showing { margin: 0; padding: 0 18px 12px; color: var(--cl-text); }
.cl-locmap__showing strong { color: var(--cl-dark); }
.cl-locmap__filter,
.cl-locmap__back {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: 0; border-radius: 12px;
  background: #fff; color: var(--cl-muted);
  display: grid; place-items: center; cursor: pointer;
  transition: color 0.2s ease;
}
.cl-locmap__filter:hover,
.cl-locmap__back:hover { color: var(--cl-purple); }
.cl-locmap__filter svg,
.cl-locmap__back svg { width: 20px; height: 20px; }

/* One branch at a time: the list gives way to the open card, with a way back. */
.cl-locmap__back,
.cl-locmap__detail-title,
.cl-locmap__detail-dist { display: none; }
.cl-locmap__detail-title {
  flex: 1;
  margin: 0;
  font-weight: 700;
  color: var(--cl-dark);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 1.35rem;
  line-height: 1.1;
}
.cl-locmap__detail-dist { color: var(--cl-muted); font-size: var(--fs-small); flex: 0 0 auto; }

.cl-locmap__panel.is-detail .cl-locmap__showing,
.cl-locmap__panel.is-detail .cl-locmap__filter { display: none; }
.cl-locmap__panel.is-detail .cl-locmap__back { display: grid; }
.cl-locmap__panel.is-detail .cl-locmap__detail-title { display: block; }
.cl-locmap__panel.is-detail .cl-locmap__detail-dist { display: inline; }
/* The name and distance now live in the header, so the card drops its own
   heading row and its background — only the schedule keeps one. */
.cl-locmap__panel.is-detail .cl-locmap__row { display: none; }
/* The address is the first contact row, so it must sit in the same rhythm as
   the phone, email and manager below it rather than in its own block. */
.cl-locmap__panel.is-detail .cl-locmap__summary { padding-bottom: 0; }
.cl-locmap__panel.is-detail .cl-locmap__addr { margin: 0 0 10px; }
.cl-locmap__panel.is-detail .cl-locmap__facts { padding-top: 0; }
/* The full schedule is right below, so the one-line status is redundant. */
.cl-locmap__panel.is-detail .cl-locmap__status { display: none; }
.cl-locmap__panel.is-detail .cl-locmap__item:not(.is-open) { display: none; }
.cl-locmap__panel.is-detail .cl-locmap__summary { cursor: default; }
/* The open branch is shown in full, so nothing is cut off or scrolled. */
.cl-locmap__panel.is-detail { max-height: none; }
.cl-locmap__panel.is-detail .cl-locmap__list { overflow: visible; }

/* A column, not a grid: grid rows would share the panel's height and squash
   the cards. min-height keeps the scroll area working inside the flex panel. */
.cl-locmap__list {
  list-style: none;
  margin: 0;
  padding: 6px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cl-locmap__item { flex: 0 0 auto; }

/* A quiet scrollbar so the list reads as scrollable without shouting. */
.cl-locmap__list { scrollbar-width: thin; scrollbar-color: #C9C9D6 transparent; }
.cl-locmap__list::-webkit-scrollbar { width: 6px; }
.cl-locmap__list::-webkit-scrollbar-thumb { background: #C9C9D6; border-radius: 3px; }
.cl-locmap__list::-webkit-scrollbar-track { background: transparent; }

/* ---------- One branch ---------- */
.cl-locmap__item {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.cl-locmap__panel { min-height: 0; }
/* Nothing behind the open card: it sits straight on the panel. */
.cl-locmap__item.is-open { background: transparent; }
.cl-locmap__summary {
  width: 100%;
  display: block;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 16px 18px;
  font-family: inherit;
}
.cl-locmap__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.cl-locmap__name {
  font-weight: 700;
  color: var(--cl-dark);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.cl-locmap__dist { color: var(--cl-muted); font-size: var(--fs-small); flex: 0 0 auto; }
/* The address carries a pin and reads as normal text, not a caption. */
.cl-locmap__addr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  color: var(--cl-text);
  font-size: var(--fs-small);
}
.cl-locmap__aico {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--cl-purple);
  display: grid;
  place-items: center;
}
.cl-locmap__aico svg { width: 18px; height: 18px; }

.cl-locmap__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-weight: 600;
  font-size: var(--fs-small);
}
.cl-locmap__status svg { width: 16px; height: 16px; }
.cl-locmap__status.is-open { color: var(--cl-green); }
.cl-locmap__status.is-later { color: var(--cl-gold); }
.cl-locmap__status.is-closed { color: var(--cl-muted); }

/* ---------- Expanded details ---------- */
/* Everything sits in one child, otherwise only the first row would collapse
   and the hours and buttons would stay on screen. */
.cl-locmap__details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.cl-locmap__item.is-open .cl-locmap__details { grid-template-rows: 1fr; }
.cl-locmap__details-in { overflow: hidden; min-height: 0; }

/* Contacts: an icon in place of each label. */
.cl-locmap__facts {
  list-style: none;
  margin: 0;
  padding: 2px 18px 0;
  display: grid;
  gap: 10px;
  font-size: var(--fs-small);
}
.cl-locmap__facts li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cl-text);
}
.cl-locmap__fico {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--cl-purple);
  display: grid;
  place-items: center;
}
.cl-locmap__fico svg { width: 18px; height: 18px; }
.cl-locmap__facts a { color: var(--cl-text); }
.cl-locmap__facts a:hover { color: var(--cl-purple); }

/* Only the schedule sits on white. */
.cl-locmap__hours-title {
  margin: 18px 18px 8px;
  font-weight: 600;
  color: var(--cl-muted);
  font-size: var(--fs-xsmall);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cl-locmap__hoursbox {
  margin: 0 18px 4px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 12px;
}
.cl-locmap__hours {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
.cl-locmap__hours th,
.cl-locmap__hours td {
  padding: 5px 0;
  text-align: left;
  font-weight: 400;
  color: var(--cl-muted);
  border: 0;
}
.cl-locmap__hours td { text-align: right; }
.cl-locmap__hours tr.is-today th,
.cl-locmap__hours tr.is-today td { color: var(--cl-dark); font-weight: 700; }

.cl-locmap__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 18px 18px;
}
.cl-locmap__actions .btn { flex: 1 1 auto; text-align: center; padding: 12px 18px; font-size: var(--fs-small); }

/* ---------- Marker ----------
   The pin must be a block: a plain inline span ignores width and height, which
   is why nothing showed on the map. */
.cl-locmap-marker { background: none; border: 0; }
.cl-locmap-pin {
  display: block;
  position: relative;
  width: 30px;
  height: 30px;
  box-sizing: border-box;
  background: var(--cl-purple);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 16px rgba(22, 4, 66, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
.cl-locmap-pin::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}
.cl-locmap-pin.is-active {
  background: var(--cl-gold);
  transform: rotate(-45deg) scale(1.18);
  z-index: 600;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  /* The list comes first and the map follows it, rather than the panel
     sitting on top of the pins. */
  .cl-locmap__stage {
    height: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 18px;
  }
  .cl-locmap__canvas { position: relative; height: 320px; }
  .cl-locmap__panel {
    position: relative;
    top: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: none;
    margin: 0 var(--cl-gutter);
    border-radius: 16px;
  }
  /* The list scrolls in list mode, but an opened branch is shown in full —
     otherwise the panel clips its buttons. */
  .cl-locmap__list { max-height: 460px; }
  .cl-locmap__panel.is-detail .cl-locmap__list { max-height: none; overflow: visible; }
  .cl-locmap__actions .btn { flex: 1 1 100%; }
}

/* The data credit has to stay, but it can be quiet. */
.cl-locmap .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.72);
  color: #8A8A99;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px 0 0 0;
}
.cl-locmap .leaflet-control-attribution a { color: #8A8A99; }

/* =========================================================
   Full screen: one page, every branch
   The map fills the viewport, runs under the header and stops at the footer.
   ========================================================= */
.cl-locmap.is-fullscreen {
  padding: 0 !important;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}
.cl-locmap.is-fullscreen .cl-locmap__stage {
  height: 100vh;
  height: 100dvh;   /* honours the browser chrome on phones */
}
.cl-locmap.is-fullscreen .cl-locmap__canvas { border-radius: 0; }

/* The heading floats over the map instead of pushing it down. */
.cl-locmap.is-fullscreen .cl-locmap__head {
  position: absolute;
  top: calc(var(--cl-header-h) + 24px);
  left: 0;
  right: 0;
  z-index: 500;
  margin: 0 auto;
  pointer-events: none;
}
.cl-locmap.is-fullscreen .cl-locmap__heading,
.cl-locmap.is-fullscreen .cl-locmap__sub {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 10px 18px;
  display: inline-block;
}

/* The panel clears the header. */
.cl-locmap.is-fullscreen .cl-locmap__panel {
  /* Flush with the edge of the header pill above it. Pinning both top and
     bottom keeps the panel inside the window whatever the list length. */
  left: var(--cl-gutter);
  top: calc(var(--cl-header-h) + 20px);
  bottom: 24px;
  max-height: none;
  margin-bottom: 25px;
}
.cl-locmap.is-fullscreen .cl-locmap__panel.is-detail { max-height: none; }
.cl-locmap.is-fullscreen .cl-locmap__panel.is-detail .cl-locmap__list { overflow-y: auto; }

@media (max-width: 900px) {
  /* Full-screen map with the list floating over the top; the pins are fitted
     into the space below the list (view.js adds the list height as top padding). */
  .cl-locmap.is-fullscreen .cl-locmap__stage { height: 100vh; height: 100dvh; }
  .cl-locmap.is-fullscreen .cl-locmap__canvas { position: absolute; inset: 0; height: auto; }
  .cl-locmap.is-fullscreen .cl-locmap__panel {
    position: absolute;
    top: calc(var(--cl-header-h, 68px) + 14px);
    left: var(--cl-gutter);
    right: var(--cl-gutter);
    bottom: auto;
    width: auto;
    max-width: none;
    max-height: 44vh;
    margin: 0;
  }
  .cl-locmap.is-fullscreen .cl-locmap__head { display: none; }
}

/* The zoom buttons sit clear of the window edge. */
.cl-locmap .leaflet-bottom.leaflet-right { margin: 0 18px 18px 0; }
.cl-locmap .leaflet-control-zoom { border: 0; box-shadow: 0 6px 18px rgba(22, 4, 66, 0.16); }

/* The scroll area fades out at the bottom, so a half-visible card reads as
   "there is more" rather than as a cut-off. */
.cl-locmap__list {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%);
}
.cl-locmap__panel.is-detail .cl-locmap__list {
  -webkit-mask-image: none;
  mask-image: none;
}

/* =========================================================
   Search, filters and sorting
   ========================================================= */
.cl-locmap__search { flex: 1; min-width: 0; }
.cl-locmap__q {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1px solid #FFF;
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: var(--fs-small);
  color: var(--cl-text);
}
.cl-locmap__q::placeholder { color: var(--cl-muted); }
.cl-locmap__q:focus {
  outline: none;
  border-color: var(--cl-purple);
  box-shadow: 0 0 0 3px rgba(73, 11, 102, 0.12);
}

/* Filters take over the panel, the way an opened branch does. */
.cl-locmap__filters { display: none; }
.cl-locmap__panel.is-filters .cl-locmap__filters { display: grid; }
.cl-locmap__panel.is-filters .cl-locmap__list,
.cl-locmap__panel.is-filters .cl-locmap__showing,
.cl-locmap__panel.is-filters .cl-locmap__empty { display: none; }

.cl-locmap__filters {
  gap: 14px;
  padding: 4px 18px 18px;
  align-content: start;
  overflow-y: auto;
}
.cl-locmap__field { display: grid; gap: 7px; }
.cl-locmap__flabel {
  font-size: var(--fs-xsmall);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cl-muted);
}

/* Options are chips, not dropdowns: everything is visible at a glance. */
.cl-locmap__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.cl-locmap__chip {
  border: 1px solid #E2E2EA;
  background: #fff;
  color: var(--cl-text);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: var(--fs-small);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.cl-locmap__chip:hover { border-color: var(--cl-purple); color: var(--cl-purple); }
.cl-locmap__chip.is-on {
  background: var(--cl-purple);
  border-color: var(--cl-purple);
  color: #fff;
}

.cl-locmap__apply {
  width: 100%;
  margin-top: 4px;
  padding: 13px 22px;
  font-size: var(--fs-small);
  text-align: center;
}

.cl-locmap__empty {
  margin: 0;
  padding: 6px 18px 18px;
  color: var(--cl-muted);
  font-size: var(--fs-small);
}

/* The controls belong to the list, not to a branch that is open. */
.cl-locmap__panel.is-detail .cl-locmap__search,
.cl-locmap__panel.is-detail .cl-locmap__showing,
.cl-locmap__panel.is-detail .cl-locmap__filters,
.cl-locmap__panel.is-detail .cl-locmap__empty { display: none; }

.cl-locmap__count { color: inherit; }

/* Sits in the head row with the search and the filter button, and only while
   the filters are open. */
.cl-locmap__fback { display: none; }
.cl-locmap__panel.is-filters .cl-locmap__fback { display: grid; }
.cl-locmap__panel.is-detail .cl-locmap__fback { display: none; }

.cl-locmap__fback {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--cl-muted);
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease;
}
.cl-locmap__fback:hover { color: var(--cl-purple); }
.cl-locmap__fback svg { width: 20px; height: 20px; }
