/* =============================================================================
   Fencepost Clients Map — v2 styles
   ============================================================================= */

/* Visually hidden helper (still accessible to screen readers) */
.fp-clients-section .screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden;
}

/* ---- Section container + AEO summary --------------------------------------- */

.fp-clients-section {
  --fp-purple: #B729E3;
  --fp-purple-soft: #c54ce0;
  --fp-gray: #94a3b8;
  --fp-text: #0f172a;
  --fp-text-soft: #475569;
  --fp-border: #e5e7eb;
  --fp-state-stroke: #cbd5e1;
  --fp-focus: #2563eb;

  position: relative;
  font-family: inherit;
  color: var(--fp-text);
  margin: 0 auto;
}

/* Bulletproof reset for the section's own buttons/inputs so theme styles
   (Hello Elementor, etc.) can't apply pink borders / wonky padding. */
.fp-clients-section button,
.fp-clients-section input[type="search"],
.fp-clients-section select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  line-height: 1;
}
.fp-clients-section button { cursor: pointer; }

/* Defeat theme :focus / :active / :focus-visible rules that try to paint
   our buttons (e.g. Elementor's pink focus background). Specific buttons
   that NEED a background on focus restore it below. */
.fp-clients-section button:focus,
.fp-clients-section button:focus-visible,
.fp-clients-section button:active {
  background-color: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
}

/* Restore visible backgrounds for the buttons whose base state is solid */
.fp-clients-section .fp-info-card__cta:focus,
.fp-clients-section .fp-info-card__cta:focus-visible,
.fp-clients-section .fp-info-card__cta:active {
  background-color: var(--fp-purple) !important;
  color: #fff !important;
}
.fp-clients-section .fp-clients-toggle:focus,
.fp-clients-section .fp-clients-toggle:focus-visible,
.fp-clients-section .fp-clients-toggle:active {
  background-color: #fff !important;
  color: #374151 !important;
}
.fp-clients-section .fp-zoom-btn:focus,
.fp-clients-section .fp-zoom-btn:focus-visible,
.fp-clients-section .fp-zoom-btn:active {
  background-color: #fff !important;
  color: #374151 !important;
}

/* ---- Stage: map + (toggle) list panel -------------------------------------- */

.fp-clients-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: #fff;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  /* Aspect ratio is locked to the cropped viewBox geometry (900 × 589) so
     the stage height never gets dragged taller by the 60-item list when
     it's open. Closed = full visible map aspect; open = map at 68% column. */
  aspect-ratio: 900 / 589;
  transition: grid-template-columns .28s ease;
}
.fp-clients-stage[data-list-open="true"] {
  grid-template-columns: 32% 1fr;
  border: 1px solid var(--fp-border);
  /* With 32% list / 68% map columns, the map's height = 0.68 × 589 / 900
     × stage_width ≈ stage_width × 0.445. Stage aspect ≈ 900 / 400. */
  aspect-ratio: 900 / 400;
}

.fp-clients-map {
  position: relative;
  width: 100%;
  background: #fff;
}
.fp-clients-map svg {
  display: block; width: 100%; height: auto;
}

/* ---- State paths ----------------------------------------------------------- */

.fp-state-path {
  fill: #e8e8e8;
  stroke: #22c55e;
  stroke-width: 0.8;
  stroke-linejoin: round;
}

/* ---- Pins (existing visual preserved) -------------------------------------- */

.fp-pin {
  outline: none;
  transition: filter .15s;
}
.fp-pin:focus-visible {
  filter: drop-shadow(0 0 0 2px var(--fp-focus));
}

/* ---- Clusters -------------------------------------------------------------- */

.fp-cluster { cursor: pointer; outline: none; }
.fp-cluster circle {
  fill: var(--fp-purple);
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
  transition: transform .15s ease;
}
.fp-cluster.fp-cluster-previous circle { fill: var(--fp-gray); }
.fp-cluster text {
  fill: #fff;
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
  user-select: none;
}
/* Ambient pulse so clusters read as interactive */
.fp-cluster circle {
  animation: fp-pulse 2.4s ease-in-out infinite;
}
@keyframes fp-pulse {
  0%, 100% { transform: scale(1);     }
  50%      { transform: scale(1.06);  }
}
.fp-cluster:focus-visible circle {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

/* ---- Toggle button (Client List) ------------------------------------------- */

.fp-clients-section .fp-clients-toggle {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 8;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .10);
  transition: background .15s, box-shadow .15s, transform .15s, color .15s;
}
.fp-clients-section .fp-clients-toggle:hover {
  background: #f9fafb;
  color: #111827;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
  transform: translateY(-1px);
}

/* Desktop hover signals: grab cursor, lifted stage, lightened state fills
   so the user immediately recognizes the map is interactive (avoids the
   "scroll-jail" surprise from wheel-zoom). */
@media (hover: hover) and (pointer: fine) {
  .fp-clients-map { cursor: grab; }
  .fp-clients-map:active { cursor: grabbing; }

  .fp-clients-stage {
    transition: border-color .18s ease, box-shadow .18s ease;
  }
  .fp-clients-stage:hover {
    border: 1px solid var(--fp-border);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
  }

  .fp-state-path { transition: fill .18s ease; }
  .fp-clients-map:hover .fp-state-path { fill: #f5f5f5; }
}

/* Hover-to-reveal: desktop only. Touch devices keep their always-visible
   pull-up tab via the mobile media query further down. */
@media (hover: hover) and (pointer: fine) {
  .fp-clients-section .fp-clients-toggle {
    opacity: 0;
    pointer-events: none;
    transition:
      opacity .18s ease .35s,
      background .15s, box-shadow .15s, transform .15s, color .15s;
  }
  .fp-clients-section:hover .fp-clients-toggle,
  .fp-clients-section:focus-within .fp-clients-toggle {
    opacity: 1;
    pointer-events: auto;
    transition:
      opacity .18s ease 0s,
      background .15s, box-shadow .15s, transform .15s, color .15s;
  }
}
.fp-clients-section .fp-clients-toggle:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}
.fp-clients-section .fp-clients-toggle .fp-clients-toggle__icon {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px;
  max-height: 16px;
  min-width: 16px;
  min-height: 16px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  /* Inherit text color so the icon's currentColor fills track the pill's
     text color (slate-700) instead of white-on-white. */
}
/* Hide the toggle entirely when the list is open.
   Toggle is a *sibling* of the stage (not a descendant), so use ~. */
.fp-clients-stage[data-list-open="true"] ~ .fp-clients-toggle { display: none; }
/* Also hide while the info card is open on mobile so they don't stack */
.fp-clients-section.fp-card-open .fp-clients-toggle {
  opacity: 0; pointer-events: none;
}

/* ---- Zoom controls (bottom-left desktop, hidden on touch) ------------------ */

.fp-zoom-controls {
  position: absolute;
  bottom: 12px; right: 12px;
  z-index: 7;
  display: flex; flex-direction: column; gap: 4px;
  opacity: 0;
  transition: opacity .2s;
}
.fp-clients-map:hover .fp-zoom-controls,
.fp-zoom-controls:focus-within {
  opacity: 1;
}
.fp-clients-section .fp-zoom-btn {
  width: 32px; height: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 18px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center;
  color: #374151;
  transition: background .15s;
}
.fp-clients-section .fp-zoom-btn:hover:not(:disabled) { background: #f9fafb; }
.fp-clients-section .fp-zoom-btn:disabled { opacity: .35; cursor: default; }
.fp-clients-section .fp-zoom-btn:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

/* ---- Hover tooltip --------------------------------------------------------- */

.fp-hover-label {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  background: #fff;
  color: var(--fp-text);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
  max-width: 280px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.4;
}
.fp-hover-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}
.fp-hover-card__logo {
  width: 44px; height: 44px;
  object-fit: contain;
  background: #fafafa;
  border-radius: 6px;
  display: block;
}
.fp-hover-card__body { min-width: 0; }
.fp-hover-card__name {
  font-weight: 700;
  font-size: 14px;
  color: var(--fp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fp-hover-card__loc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--fp-text-soft);
}
/* When a cluster shows a plain text label, keep it compact */
.fp-hover-label:not(:has(.fp-hover-card)) {
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 12px;
}

/* ---- Client list panel ----------------------------------------------------- */

.fp-clients-list {
  display: none;
  background: #fff;
  border-right: 1px solid var(--fp-border);
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.fp-clients-stage[data-list-open="true"] .fp-clients-list {
  display: flex;
  /* Stretch to the grid cell height (which is map-aspect-locked, see stage). */
  height: 100%;
  max-height: 100%;
}
/* The items list inside scrolls when there are more clients than fit */
.fp-clients-list__items {
  min-height: 0;
}

.fp-clients-list__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--fp-border);
  background: var(--fp-bg);
}
.fp-clients-list__title {
  margin: 0; font-size: 15px; font-weight: 700;
  color: var(--fp-text);
}
.fp-clients-section .fp-clients-list__close {
  width: 28px; height: 28px;
  font-size: 22px; line-height: 1;
  color: var(--fp-text-soft);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.fp-clients-section .fp-clients-list__close:hover { background: #f3f4f6; color: var(--fp-text); }
.fp-clients-section .fp-clients-list__close:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

.fp-clients-list__controls {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--fp-border);
}
.fp-clients-section .fp-clients-list__search input,
.fp-clients-section .fp-clients-list__filter select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.2;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: var(--fp-text);
}
.fp-clients-section .fp-clients-list__filter select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23475569'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
}
.fp-clients-section .fp-clients-list__search input:focus,
.fp-clients-section .fp-clients-list__filter select:focus {
  outline: 2px solid var(--fp-focus);
  outline-offset: 1px;
}

.fp-clients-list__items {
  list-style: none; margin: 0; padding: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}
.fp-clients-list__item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .12s;
}
.fp-clients-list__item:hover,
.fp-clients-list__item.is-highlighted {
  background: #faf5fc;
}
.fp-clients-list__logo {
  width: 48px; height: 48px;
  object-fit: contain;
  background: #fafafa;
  border-radius: 8px;
}
.fp-clients-list__logo--placeholder {
  display: inline-block;
  background: linear-gradient(135deg, #e5e7eb, #cbd5e1);
}
.fp-clients-list__body { min-width: 0; }
.fp-clients-list__name {
  margin: 0; font-size: 14px; font-weight: 600; color: var(--fp-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fp-clients-list__loc {
  margin: 2px 0 0; font-size: 12px; color: var(--fp-text-soft);
}
.fp-clients-list__link {
  font-size: 12px;
  font-weight: 600;
  color: var(--fp-purple);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
}
.fp-clients-list__link:hover { background: #f3e7f7; }
.fp-clients-list__link:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

/* ---- Backdrop (dims everything behind the info card) ----------------------- */

.fp-info-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.fp-clients-section.fp-card-open .fp-info-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Info card (desktop: floating anchored, mobile: bottom sheet) ---------- */

.fp-info-card {
  position: fixed;
  z-index: 9999;
  width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.fp-info-card.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fp-info-card__inner {
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.fp-info-card__logo-wrap {
  width: 64px; height: 64px;
  align-self: flex-start;
  border-radius: 10px;
  background: #fff;            /* white so letterbox area on object-fit:contain stays clean */
  position: relative;
  overflow: hidden;
}
.fp-info-card__logo-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
  background-size: 200% 100%;
  animation: fp-skeleton 1.2s ease-in-out infinite;
}
.fp-info-card__logo-wrap.is-loaded::before { display: none; }
.fp-info-card__logo {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
  opacity: 0;
  transition: opacity .18s ease;
  position: relative;  /* stack above ::before */
  z-index: 1;
}
.fp-info-card__logo-wrap.is-loaded .fp-info-card__logo { opacity: 1; height: 100%; }
@keyframes fp-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.fp-info-card__name {
  margin: 0; font-size: 18px; font-weight: 700; color: var(--fp-text);
}
.fp-info-card__loc {
  margin: 0; font-size: 13px; color: var(--fp-text-soft);
}
.fp-info-card__cta {
  display: inline-block;
  background: var(--fp-purple);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  margin-top: 4px;
  transition: background .15s;
}
.fp-info-card__cta:hover  { background: var(--fp-purple-soft); }
.fp-info-card__cta:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

/* Secondary outline button under "Visit Website" */
.fp-info-card__maps {
  display: inline-block;
  background: #fff;
  color: var(--fp-purple);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;          /* -1 px vs primary to compensate for border */
  border: 1px solid var(--fp-purple);
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  transition: background .15s, color .15s;
}
.fp-info-card__maps:hover { background: #faf5fc; }
.fp-info-card__maps:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}
.fp-info-card .fp-info-card__close {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  background: none; border: 0;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--fp-text-soft);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  box-shadow: none;
}
.fp-info-card .fp-info-card__close:hover { background: #f3f4f6; color: var(--fp-text); }
.fp-info-card .fp-info-card__close:focus-visible {
  outline: 2px solid var(--fp-focus);
  outline-offset: 2px;
}

/* Mobile bottom sheet variant */
.fp-info-card.is-mobile {
  width: auto;
  left: 0 !important; right: 0;
  top: auto !important; bottom: 0;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
}
.fp-info-card.is-mobile.is-open {
  transform: translateY(0);
}
.fp-info-card.is-mobile .fp-info-card__inner {
  padding: 22px 20px 28px;
}
.fp-info-card.is-mobile::before {
  content: "";
  display: block;
  width: 40px; height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 8px auto 4px;
}

/* ---- FAQ ------------------------------------------------------------------- */

.fp-clients-faq {
  margin: 32px 0 0;
  padding: 24px;
  background: var(--fp-bg);
  border-radius: 12px;
  border: 1px solid var(--fp-border);
}
.fp-clients-faq__title {
  margin: 0 0 12px;
  font-size: 18px;
}
.fp-clients-faq__list dt {
  font-weight: 600;
  margin: 14px 0 4px;
  color: var(--fp-text);
}
.fp-clients-faq__list dt:first-child { margin-top: 0; }
.fp-clients-faq__list dd {
  margin: 0 0 4px;
  color: var(--fp-text-soft);
  font-size: 14px;
  line-height: 1.55;
}

/* ---- Mobile breakpoint ----------------------------------------------------- */

/* Hint text is mobile-only (hidden on desktop). */
.fp-clients-hint { display: none; }

@media (max-width: 720px), (pointer: coarse) {
  /* Hide zoom buttons — pinch is enough */
  .fp-zoom-controls { display: none; }

  /* Default compact view: just the map. No toggle, no list, no border. */
  .fp-clients-section .fp-clients-toggle { display: none; }
  .fp-clients-section .fp-clients-list   { display: none; }
  .fp-clients-stage,
  .fp-clients-stage[data-list-open="true"] {
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  /* The hint paragraph beneath the map */
  .fp-clients-hint {
    display: block;
    margin: 8px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--fp-text-soft);
  }

  /* ----- Fullscreen takeover ----- */
  .fp-clients-section.is-mobile-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    margin: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
  }
  .fp-clients-section.is-mobile-fullscreen .fp-clients-hint { display: none; }
  .fp-clients-section.is-mobile-fullscreen .fp-clients-stage {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
  .fp-clients-section.is-mobile-fullscreen .fp-clients-map {
    order: 1;             /* map on top regardless of DOM order */
    flex: 0 0 40vh;
    min-height: 40vh;
    border-bottom: 1px solid var(--fp-border);
    overflow: hidden;
  }
  /* The SVG is set to height:auto inline by JS; force it to fill the 40vh
     container in fullscreen mode. preserveAspectRatio still keeps the
     content from stretching. */
  .fp-clients-section.is-mobile-fullscreen .fp-clients-map svg {
    height: 100% !important;
    width: 100% !important;
  }
  .fp-clients-section.is-mobile-fullscreen .fp-clients-list {
    order: 2;             /* list below the map */
    display: flex !important;
    flex: 1 1 60vh;
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    transform: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    z-index: auto;
  }
}

/* Body scroll lock while the mobile takeover is active */
body.fp-clients-locked {
  overflow: hidden;
  touch-action: none;
}

/* ---- Pin focus ring (desktop keyboard nav) --------------------------------- */
.fp-pin:focus-visible path,
.fp-pin:focus-visible circle {
  filter: drop-shadow(0 0 2px var(--fp-focus));
}

/* ---- Selection + hover highlight (always green) ----------------------------
   Placed at the end of the file so cascade order beats the earlier
   .fp-cluster.fp-cluster-previous / .fp-pin-previous fill rules. */
.fp-pin.is-selected   .fp-pin__body,
.fp-pin.is-hovered    .fp-pin__body { fill: #22c55e !important; }
.fp-cluster.is-selected circle,
.fp-cluster.is-hovered  circle      { fill: #22c55e !important; }

/* Persistent purple-tint row when a client is selected from the list. */
.fp-clients-list__item.is-selected {
  background: #faf5fc;
}
