/* =========================================================
   ODYSSEY â€” LOCATIONS EXPLORER
   Shortcode: [obh_location_map]

   VISUAL EDITING GUIDE
   - Change treatment colors, marker styling, cluster styling,
     legend sizing, spacing, and popup appearance in the
     DESIGN TOKENS block below.
   - JavaScript should control behavior only and read cluster
     visual values from these CSS custom properties.
   ========================================================= */


/* =========================================================
   1. MAP DESIGN TOKENS
   Central visual control panel.
   ========================================================= */

.obh-location-explorer {
  /* -------------------------
     Treatment colors
     ------------------------- */
  --obh-map-color-all: #102a4d;
  --obh-map-color-mental: #204e88;
  --obh-map-color-substance: #83b2d5;
  --obh-map-color-substance-light: #b2d9f5;
  --obh-map-color-eating: #9a52a8;
  --obh-map-color-autism: #7bd4f4;

  /* -------------------------
     Filter rail / tabs
     ------------------------- */
  --obh-map-controls-width: 1120px;
  --obh-map-filter-row-gap: 18px;
  --obh-map-filter-min-height: 52px;
  --obh-map-filter-padding-x: 12px;
  --obh-map-filter-padding-bottom: 15px;
  --obh-map-filter-font-size: 0.93rem;
  --obh-map-filter-font-weight: 500;
  --obh-map-filter-active-weight: 700;
  --obh-map-filter-baseline-width: 2px;
  --obh-map-filter-baseline-color: rgba(16, 42, 77, 0.13);
  --obh-map-filter-indicator-height: 4px;
  --obh-map-filter-indicator-inset: 18%;

  /* -------------------------
     Legend + result count
     ------------------------- */
  --obh-map-legend-gap-row: 10px;
  --obh-map-legend-gap-column: 24px;
  --obh-map-legend-margin-bottom: 14px;
  --obh-map-legend-font-size: 0.87rem;
  --obh-map-legend-swatch-size: 12px;
  --obh-map-legend-swatch-border: rgba(255, 255, 255, 0.80);
  --obh-map-result-margin-bottom: 12px;
  --obh-map-result-font-size: 0.9rem;

  /* -------------------------
     Map frame
     ------------------------- */
  --obh-map-height: 608px;
  --obh-map-radius: 3px;
  --obh-map-background: #e8f0f8;

  /* -------------------------
     Individual markers
     ------------------------- */
  --obh-map-marker-size: 22px;
  --obh-map-marker-inner-inset: 6px;
  --obh-map-marker-border-width: 1px;
  --obh-map-marker-border-color: rgba(255, 255, 255, 0.72);
  --obh-map-marker-inner-color: rgba(255, 255, 255, 0.92);
  --obh-map-marker-shadow: 0 3px 10px rgba(16, 42, 77, 0.22);
  --obh-map-marker-shadow-hover: 0 5px 15px rgba(16, 42, 77, 0.28);
  --obh-map-marker-hover-scale: 1.12;

  /* -------------------------
   Cluster appearance
   JavaScript reads these values only.
   All cluster visuals are controlled here.
   ------------------------- */

--obh-map-cluster-size: 48;
--obh-map-cluster-core-radius: 24;
--obh-map-cluster-ring-radius: 28;
--obh-map-cluster-outer-radius: 31;

--obh-map-cluster-gradient-start: var(--obh-primary);
--obh-map-cluster-gradient-end: var(--obh-purple-fill);

--obh-map-cluster-ring-color: rgba(255, 255, 255, 0.70);
--obh-map-cluster-ring-width: 2;

--obh-map-cluster-outer-color: var(--obh-primary);
--obh-map-cluster-outer-opacity: 0.18;
--obh-map-cluster-outer-width: 2;

--obh-map-cluster-text-color: var(--obh-white);
--obh-map-cluster-font-size: 12px;
--obh-map-cluster-font-weight: 700;
	
  /* -------------------------
     Individual facility marker labels
     ------------------------- */
  --obh-map-label-gap: 8px;
  --obh-map-label-max-width: 180px;
  --obh-map-label-padding-y: 5px;
  --obh-map-label-padding-x: 8px;
  --obh-map-label-radius: 3px;
  --obh-map-label-font-size: 0.72rem;
  --obh-map-label-font-weight: 600;
  --obh-map-label-text: #ffffff;
  --obh-map-label-shadow: 0 3px 10px rgba(16, 42, 77, 0.20);

  /* -------------------------
     Info window / map card
     ------------------------- */
  --obh-map-popup-max-width: 300px;
  --obh-map-popup-card-width: 286px;
  --obh-map-popup-radius: 3px;
  --obh-map-popup-shadow: 0 14px 34px rgba(16, 42, 77, 0.20);
  --obh-map-popup-padding: 16px;

  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


/* =========================================================
   2. TREATMENT FILTER RAIL
   ========================================================= */

.obh-location-map__filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));

  width: min(100%, var(--obh-map-controls-width));

  margin: 0 auto var(--obh-map-filter-row-gap);
  padding: 0;

  border: 0;
  border-bottom:
    var(--obh-map-filter-baseline-width)
    solid
    var(--obh-map-filter-baseline-color);

  background: transparent;
  box-sizing: border-box;
}

button.obh-location-map__filter {
  appearance: none !important;

  position: relative;

  display: flex !important;
  align-items: flex-end;
  justify-content: center;

  width: 100%;
  min-width: 0;
  min-height: var(--obh-map-filter-min-height);

  margin: 0 !important;
  padding:
    0
    var(--obh-map-filter-padding-x)
    16px !important;

  color: rgba(16, 42, 77, 0.70) !important;
  background: transparent !important;

  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  font-family: var(--obh-font-body) !important;
  font-size: var(--obh-map-filter-font-size) !important;
  font-weight: var(--obh-map-filter-font-weight) !important;
  line-height: 1.25 !important;
  letter-spacing: -0.1px !important;

  text-align: center;
  text-decoration: none !important;

  cursor: pointer;

  transition:
    color 180ms ease,
    font-weight 180ms ease;

  box-sizing: border-box;
}

button.obh-location-map__filter::after {
  content: "";

  position: absolute;
  left: var(--obh-map-filter-indicator-inset);
  right: var(--obh-map-filter-indicator-inset);
  bottom: -1px;

  height: var(--obh-map-filter-indicator-height);

  background: transparent;
  opacity: 0;

  transform: scaleX(0.35);
  transform-origin: center;

  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

button.obh-location-map__filter:hover,
button.obh-location-map__filter:focus-visible,
button.obh-location-map__filter.is-active {
  color: var(--obh-navy) !important;
}

button.obh-location-map__filter.is-active {
  font-weight: var(--obh-map-filter-active-weight) !important;
}

button.obh-location-map__filter.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

button.obh-location-map__filter[data-treatment="all"].is-active::after {
  background:
    linear-gradient(
      90deg,
      var(--obh-map-color-mental),
      var(--obh-map-color-eating)
    );
}

button.obh-location-map__filter--mental.is-active::after {
  background:
    linear-gradient(
      90deg,
      var(--obh-map-color-mental),
      var(--obh-blue)
    );
}

button.obh-location-map__filter--substance.is-active::after {
  background:
    linear-gradient(
      90deg,
      var(--obh-map-color-substance),
      var(--obh-map-color-substance-light)
    );
}

button.obh-location-map__filter--eating.is-active::after {
  background:
    linear-gradient(
      90deg,
      var(--obh-map-color-eating),
      var(--obh-purple-fill)
    );
}

button.obh-location-map__filter--autism.is-active::after {
  background:
    linear-gradient(
      90deg,
      var(--obh-map-color-mental),
      var(--obh-map-color-autism)
    );
}

button.obh-location-map__filter:focus-visible {
  outline: 2px solid var(--obh-accent);
  outline-offset: 3px;
}


/* =========================================================
   3. MAP MARKER LEGEND
   ========================================================= */

.obh-location-map__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;

  width: min(100%, var(--obh-map-controls-width));

  gap:
    var(--obh-map-legend-gap-row)
    var(--obh-map-legend-gap-column);

  margin: 0 auto var(--obh-map-legend-margin-bottom);

  color: rgba(16, 42, 77, 0.76);

  font-family: var(--obh-font-body);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.08px;
}

.obh-location-map__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.obh-location-map__legend-swatch {
  display: inline-block;
  flex: 0 0 var(--obh-map-legend-swatch-size);

  width: var(--obh-map-legend-swatch-size);
  height: var(--obh-map-legend-swatch-size);

  border: 1px solid var(--obh-map-legend-swatch-border);
  border-radius: 50%;

  box-shadow: 0 1px 4px rgba(16, 42, 77, 0.18);
}

.obh-location-map__legend-swatch--mental {
  background: var(--obh-map-color-mental);
}

.obh-location-map__legend-swatch--substance {
  background: var(--obh-map-color-substance);
}

.obh-location-map__legend-swatch--eating {
  background: var(--obh-map-color-eating);
}

.obh-location-map__legend-swatch--autism {
  background: var(--obh-map-color-autism);
}

.obh-location-map__legend-swatch--multi {
  background:
    linear-gradient(
      135deg,
      var(--obh-map-color-mental) 0%,
      var(--obh-map-color-eating) 52%,
      var(--obh-map-color-autism) 100%
    );
}


/* =========================================================
   4. RESULT COUNT
   ========================================================= */

.obh-location-map__result-count {
  width: min(100%, var(--obh-map-controls-width));

  margin: 12px auto var(--obh-map-result-margin-bottom);

  color: var(--obh-primary);

  font-family: var(--obh-font-body);
  font-size: var(--obh-map-result-font-size);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.1px;

  text-align: center;
}


/* =========================================================
   5. MAP FRAME
   ========================================================= */

.obh-location-map {
  position: relative;

  width: 100%;
  min-height: var(--obh-map-height);

  overflow: hidden;

  border-radius: var(--obh-map-radius);
  background: var(--obh-map-background);
}

.obh-location-map__canvas {
  width: 100%;
  height: var(--obh-map-height);
  min-height: 320px;
}


/* =========================================================
   6. STATUS
   ========================================================= */

.obh-location-map__status {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;

  transform: translate(-50%, -50%);

  margin: 0;
  padding: 10px 14px;

  border-radius: 3px;

  background: rgba(255, 255, 255, 0.94);
  color: var(--obh-navy);

  font-family: var(--obh-font-body);
  font-size: 0.9rem;
  line-height: 1.3;

  box-shadow: 0 4px 18px rgba(16, 42, 77, 0.14);
}

.obh-location-map.is-ready .obh-location-map__status {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;

  border: 0 !important;
}

.obh-location-map.has-error .obh-location-map__canvas {
  opacity: 0.35;
}


/* =========================================================
   7. ADVANCED MARKERS
   ========================================================= */

.obh-map-marker {
  appearance: none;

  position: relative;
  display: block !important;

  flex: 0 0 var(--obh-map-marker-size);

  width: var(--obh-map-marker-size) !important;
  min-width: var(--obh-map-marker-size) !important;
  max-width: var(--obh-map-marker-size) !important;

  height: var(--obh-map-marker-size) !important;
  min-height: var(--obh-map-marker-size) !important;
  max-height: var(--obh-map-marker-size) !important;

  margin: 0;
  padding: 0;

  border:
    var(--obh-map-marker-border-width)
    solid
    var(--obh-map-marker-border-color);

  border-radius: 50%;

  background: var(--obh-map-color-all);
  box-shadow: var(--obh-map-marker-shadow);

  cursor: pointer;

  transition:
    transform 160ms ease,
    box-shadow 160ms ease;

  box-sizing: border-box;
}

.obh-map-marker::after {
  content: "";

  position: absolute;
  inset: var(--obh-map-marker-inner-inset);

  border-radius: 50%;
  background: var(--obh-map-marker-inner-color);
}

.obh-map-marker--all {
  background: var(--obh-map-color-all);
}

.obh-map-marker--mental {
  background: var(--obh-map-color-mental);
}

.obh-map-marker--substance {
  background: var(--obh-map-color-substance);
}

.obh-map-marker--eating {
  background: var(--obh-map-color-eating);
}

.obh-map-marker--autism {
  background: var(--obh-map-color-autism);
}

.obh-map-marker--multi {
  background:
    linear-gradient(
      135deg,
      var(--obh-map-color-mental) 0%,
      var(--obh-map-color-eating) 52%,
      var(--obh-map-color-autism) 100%
    );
}

.obh-map-marker:hover,
.obh-map-marker:focus-visible {
  transform: scale(var(--obh-map-marker-hover-scale));
  box-shadow: var(--obh-map-marker-shadow-hover);
}

.obh-map-marker:focus-visible {
  outline: 3px solid var(--obh-accent);
  outline-offset: 3px;
}

/* =========================================================
   8. INDIVIDUAL FACILITY MARKER LABELS
   ========================================================= */

.obh-map-marker-content {
  position: relative;
  display: block;

  width: var(--obh-map-marker-size);
  height: var(--obh-map-marker-size);
}


.obh-map-marker-label {
  position: absolute;

  top: 50%;
  left: calc(100% + var(--obh-map-label-gap));

  z-index: 3;

  width: max-content;
  max-width: var(--obh-map-label-max-width);

  padding:
    var(--obh-map-label-padding-y)
    var(--obh-map-label-padding-x);

  border: 0;
  border-radius: var(--obh-map-label-radius);

  background:
    linear-gradient(
      135deg,
      var(--obh-navy),
      var(--obh-purple-deep)
    ) !important;

  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;

  font-family: var(--obh-font-body);
  font-size: var(--obh-map-label-font-size);
  font-weight: var(--obh-map-label-font-weight);
  line-height: 1.2;
  letter-spacing: 0;

  text-align: left;
  white-space: normal;

  box-shadow: var(--obh-map-label-shadow);

  opacity: 0;
  visibility: hidden;

  pointer-events: none;

  transform:
    translateY(-50%)
    translateX(-3px);

  transition:
    opacity 150ms ease,
    transform 150ms ease,
    visibility 150ms ease;

  box-sizing: border-box;
}


.obh-location-explorer--show-marker-labels
.obh-map-marker-label {
  opacity: 1;
  visibility: visible;

  transform:
    translateY(-50%)
    translateX(0);
}


/* Small pointer connecting the label to its marker */

.obh-map-marker-label::before {
  content: "";

  position: absolute;

  top: 50%;
  right: 100%;

  width: 0;
  height: 0;

  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 5px solid var(--obh-navy);

  transform: translateY(-50%);
}


/* =========================================================
   8. GOOGLE INFOWINDOW
   ========================================================= */

.gm-style .gm-style-iw-c {
  max-width: var(--obh-map-popup-max-width) !important;
  padding: 0 !important;

  border-radius: var(--obh-map-popup-radius) !important;
  box-shadow: var(--obh-map-popup-shadow) !important;
}

.gm-style .gm-style-iw-d {
  max-height: none !important;
  overflow: visible !important;
}

.gm-style .gm-style-iw-chr {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
}


/* =========================================================
   9. COMPACT MAP LOCATION CARD
   ========================================================= */

.obh-map-card {
  width: min(var(--obh-map-popup-card-width), 78vw);
  margin: 0;

  color: var(--obh-navy);
  font-family: var(--obh-font-body);
}


/* ---------------------------------------------------------
   Card interior spacing
   --------------------------------------------------------- */

.obh-map-card__body {
  padding: var(--obh-map-popup-padding);
}


/* ---------------------------------------------------------
   TREATMENT TYPE
   --------------------------------------------------------- */

.obh-map-card__treatment {
  margin: 0 32px 12px 0 !important;

  color: var(--obh-primary);

  font-family: var(--obh-font-body);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.055em;

  text-transform: uppercase;
}


/* ---------------------------------------------------------
   LOCATION TITLE
   --------------------------------------------------------- */

.obh-map-card__title {
  margin: 0 32px 12px 0;

  color: var(--obh-navy);

  font-family: var(--obh-font-heading);
  font-size: 1.05rem !important;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
}


/* ---------------------------------------------------------
   FULL ADDRESS / GOOGLE MAPS LINK
   --------------------------------------------------------- */

.obh-map-card__location {
  display: block;

  margin: 0 0 16px;

  color: var(--obh-navy) !important;

  font-family: var(--obh-font-body);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;

  text-decoration: none;
}

.obh-map-card__location:hover,
.obh-map-card__location:focus-visible {
  color: var(--obh-purple) !important
}


/* ---------------------------------------------------------
   ACTION ROW
   --------------------------------------------------------- */

.obh-map-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;

  gap: 10px 16px;
}


/* ---------------------------------------------------------
   ALL ACTION LINK TYPOGRAPHY
   --------------------------------------------------------- */

.obh-map-card__link {
  color: var(--obh-primary) !important;

  font-family: var(--obh-font-body);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;

  text-decoration: underline;
  text-underline-offset: 3px;
}


/* ---------------------------------------------------------
   PRIMARY VIEW LOCATION BUTTON
   --------------------------------------------------------- */

.obh-map-card__link--primary {
  padding: 0px;

  border-radius: 0px;

  background: transparent;
  color: var(--obh-primary);

  text-decoration: underline;
}

.obh-map-card__link--primary:hover,
.obh-map-card__link--primary:focus-visible {
  color: var(--obh-purple) !important;
}


/* ---------------------------------------------------------
   KEYBOARD FOCUS
   --------------------------------------------------------- */

.obh-map-card a:focus-visible {
  outline: 3px solid var(--obh-accent);
  outline-offset: 3px;
}


/* =========================================================
   10. NOTICE
   ========================================================= */

.obh-map-notice {
  padding: 16px;

  border-left: 4px solid var(--obh-purple);

  background: #f3edf5;
  color: var(--obh-navy);
}


/* =========================================================
   11. MOBILE
   ========================================================= */

@media (max-width: 767px) {

  .obh-location-explorer {
    --obh-map-height: 560px;

    --obh-map-filter-min-height: 46px;
    --obh-map-filter-padding-bottom: 10px;
    --obh-map-filter-indicator-height: 6px;

    --obh-map-filter-row-gap: 22px;
    --obh-map-legend-margin-bottom: 18px;
    --obh-map-result-margin-bottom: 10px;

    --obh-map-legend-font-size: 0.78rem;
    --obh-map-popup-padding: 16px;
  }

  .obh-location-map__filters {
    display: flex;
    justify-content: flex-start;

    width: 100%;

    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .obh-location-map__filters::-webkit-scrollbar {
    display: none;
  }

  button.obh-location-map__filter {
    flex: 0 0 auto;
    width: auto;
    min-width: 138px;
  }

  .obh-location-map__legend {
    justify-content: center;
    gap: 8px 18px;
  }

  .obh-location-map__result-count {
    text-align: center;
  }

  .obh-map-card__title {
    font-size: 1.08rem;
  }
}


/* =========================================================
   12. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .obh-map-marker,
  button.obh-location-map__filter {
    transition: none;
  }
}
/* ---------------------------------------------------------
   LOCATION IMAGE
   --------------------------------------------------------- */

.obh-map-card__media {
  position: relative;

  width: 100%;
  height: 180px;
  max-height: 180px;

  margin: 0;
  padding: 0;

  overflow: hidden;
}

.obh-map-card__image {
  display: block;

  width: 100% !important;
  height: 100% !important;

  margin: 0;
  padding: 0;

  object-fit: cover;
  object-position: center center;
}


/* ---------------------------------------------------------
   GOOGLE MAPS INFO WINDOW CLOSE CONTROL
   --------------------------------------------------------- */

.obh-location-map__canvas .gm-ui-hover-effect {
  top: 16px !important;
  right: 16px !important;

  width: 24px !important;
  height: 24px !important;

  margin: 0 !important;
  padding: 0 !important;

  opacity: 1 !important;
}

.obh-location-map__canvas .gm-ui-hover-effect > span {
  display: block !important;

  width: 24px !important;
  height: 24px !important;

  margin: 0 !important;

  background-color: #FFFFFF !important;
  opacity: 1 !important;

  mask-size: 24px 24px !important;
  -webkit-mask-size: 24px 24px !important;
}

.obh-location-map__canvas .gm-ui-hover-effect > img {
  width: 24px !important;
  height: 24px !important;

  margin: 0 !important;

  filter: brightness(0) invert(1) !important;
  opacity: 1 !important;
}

