/* =====================================================================
   IHC Service Area Map — styles
   ---------------------------------------------------------------------
   Scoped under .ihc-sam-* and #ihc-sam-map (+ shortcode containers) so
   these rules never bleed into the rest of the site. Brand tokens
   inline per the v3 palette in feedback_brand_tokens_standing_rule.md:
       navy  #0F1C33
       gold  #D4A017
       cream #FAF6EC
   ===================================================================== */

:root {
  --ihc-sam-navy:  #0F1C33;
  --ihc-sam-gold:  #D4A017;
  --ihc-sam-cream: #FAF6EC;
  --ihc-sam-red:   #C0392B;
}

/* ---------- Homepage placement (front-page.php wraps the shortcode in
   .service-area-map-section so it gets section-style vertical breathing
   room between the B&A slider and the Why-IHC band) ---------- */
.service-area-map-section { padding: clamp(60px, 8vw, 100px) clamp(20px, 4vw, 56px); background: var(--ihc-sam-cream); }
.service-area-map-section .section-inner { max-width: 1200px; margin: 0 auto; }

/* ---------- Embed shortcode headline (only renders inside the shortcode,
   not on the full /service-area-map/ page which has its own header) ---------- */
.ihc-sam-embed-head { text-align: center; max-width: 880px; margin: 0 auto clamp(20px, 3vw, 36px); }
.ihc-sam-embed-head .ihc-sam-eyebrow { display:inline-flex; align-items:center; gap:10px; font-family:'DM Mono',monospace; font-size:11px;
  letter-spacing:.18em; text-transform:uppercase; color:var(--ihc-sam-gold); margin-bottom:12px; }
.ihc-sam-embed-head .ihc-sam-eyebrow-rule { width:28px; height:2px; background:var(--ihc-sam-gold); display:inline-block; }
.ihc-sam-embed-title { font-family:'Montserrat',sans-serif; font-weight:800; font-size:clamp(22px,3vw,32px);
  line-height:1.2; color:var(--ihc-sam-navy); margin:0 0 10px; }
.ihc-sam-embed-title [data-ihc-sam-count], .ihc-sam-embed-title [data-ihc-sam-cities] { color:var(--ihc-sam-gold); }
.ihc-sam-embed-sub { font-size:15px; line-height:1.5; color:rgba(15,28,51,.7); margin:0; }

/* ---------- Primary page wrapper ---------- */
.ihc-sam-wrap {
  background: var(--ihc-sam-cream);
  padding: clamp(2rem, 5vw, 4rem) 1rem;
}
.ihc-sam-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- Header ---------- */
.ihc-sam-head {
  text-align: center;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}
.ihc-sam-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  color: var(--ihc-sam-navy);
  margin-bottom: 0.75rem;
}
.ihc-sam-eyebrow-rule {
  display: inline-block;
  width: 40px;
  height: 2px;
  background: var(--ihc-sam-gold);
}
.ihc-sam-head h1 {
  font-family: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ihc-sam-navy);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 0.75rem;
}
.ihc-sam-head h1 .ihc-sam-count,
.ihc-sam-head h1 .ihc-sam-cities {
  color: var(--ihc-sam-gold);
}
.ihc-sam-sub {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  line-height: 1.55;
  color: #2c3a4f;
}

/* ---------- Map shell + map element ---------- */
.ihc-sam-map-shell {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 28, 51, 0.18);
  background: #e9eef5;
}
.ihc-sam-map {
  width: 100%;
  /* Full-page: tall on desktop, shorter on mobile */
  height: clamp(420px, 70vh, 700px);
  position: relative;
  z-index: 1;
}

/* Shortcode-embedded variants (constrained heights) */
.ihc-sam-map[data-ihc-sam-mode="embed"]    { height: 500px; }
.ihc-sam-map[data-ihc-sam-mode="town"]     { height: 350px; }

.ihc-sam-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 28, 51, 0.04);
  color: var(--ihc-sam-navy);
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 1rem;
  z-index: 2;
  pointer-events: none;
}
.ihc-sam-map.is-ready .ihc-sam-map-loading { display: none; }
.ihc-sam-map.is-error  .ihc-sam-map-loading {
  background: rgba(192, 57, 43, 0.06);
  color: var(--ihc-sam-red);
}

/* ---------- Toggle (top-right pill group) ---------- */
.ihc-sam-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500; /* above Leaflet panes */
  display: inline-flex;
  background: var(--ihc-sam-cream);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(15, 28, 51, 0.25);
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.ihc-sam-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ihc-sam-navy);
  font: inherit;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 40px; /* touch target */
  min-width: 88px;
  transition: background 0.18s ease, color 0.18s ease;
}
.ihc-sam-toggle-btn.is-active {
  background: var(--ihc-sam-gold);
  color: var(--ihc-sam-navy);
}
.ihc-sam-toggle-btn:focus-visible {
  outline: 2px solid var(--ihc-sam-gold);
  outline-offset: 2px;
}

/* ---------- CTA below the map ---------- */
.ihc-sam-cta {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-top: 2rem;
  padding: 1.75rem;
  background: var(--ihc-sam-navy);
  color: var(--ihc-sam-cream);
  border-radius: 12px;
}
.ihc-sam-cta-text h2 {
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin: 0 0 0.5rem;
  color: var(--ihc-sam-cream);
}
.ihc-sam-cta-text p {
  margin: 0;
  line-height: 1.55;
  color: #d8dde6;
  font-size: 1rem;
}
.ihc-sam-cta-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ihc-sam-cta-phone,
.ihc-sam-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 52px;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease;
}
.ihc-sam-cta-phone {
  background: var(--ihc-sam-cream);
  color: var(--ihc-sam-navy);
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.1;
}
.ihc-sam-cta-phone-label {
  font-size: 0.75rem;
  letter-spacing: 2px;
  opacity: 0.8;
}
.ihc-sam-cta-phone-num { font-size: 1.25rem; }
.ihc-sam-cta-btn {
  background: var(--ihc-sam-gold);
  color: var(--ihc-sam-navy);
  font-size: 1rem;
}
.ihc-sam-cta-phone:hover,
.ihc-sam-cta-btn:hover { transform: translateY(-1px); }

/* ---------- Shortcode caption (town map) ---------- */
.ihc-sam-caption {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ihc-sam-navy);
  text-align: center;
}
.ihc-sam-caption strong { color: var(--ihc-sam-gold); }

/* ---------- Shortcode wrappers ---------- */
.ihc-sam-shortcode {
  margin: 1.5rem 0;
}
.ihc-sam-shortcode .ihc-sam-map-shell { box-shadow: 0 6px 18px rgba(15, 28, 51, 0.12); }

/* ---------- Leaflet popup brand styling ---------- */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  border-top: 3px solid var(--ihc-sam-gold);
}
.leaflet-popup-content {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  margin: 0.6rem 0.85rem;
  line-height: 1.4;
}
.ihc-sam-popup-title {
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ihc-sam-navy);
  margin: 0 0 0.15rem;
}
.ihc-sam-popup-count {
  font-size: 0.92rem;
  color: #4a5568;
}
.ihc-sam-popup-count strong { color: var(--ihc-sam-gold); }

/* ---------- Marker cluster brand styling ---------- */
/* Custom cluster icon (iconCreateFunction in JS uses className "ihc-sam-cluster")
   so the cluster bubble shows the SUM of jobs in its child markers, not the
   count of pins. Style mirrors the single-city pin language. */
.ihc-sam-cluster {
  background: rgba(212, 160, 23, 0.28); /* gold halo */
  border-radius: 999px;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.ihc-sam-cluster-inner {
  background: var(--ihc-sam-navy);
  color: var(--ihc-sam-cream);
  border: 2px solid var(--ihc-sam-gold);
  border-radius: 999px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  width: 80%;
  height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  white-space: nowrap;
}
/* Fallback in case the default marker-cluster classes ever leak through */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(212, 160, 23, 0.25);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--ihc-sam-navy);
  color: var(--ihc-sam-cream);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  border: 2px solid var(--ihc-sam-gold);
}
.marker-cluster span { line-height: 30px; }

/* Single-city pin (custom DivIcon) */
.ihc-sam-pin {
  background: var(--ihc-sam-gold);
  color: var(--ihc-sam-navy);
  border: 2px solid var(--ihc-sam-navy);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  text-align: center;
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 760px) {
  .ihc-sam-cta {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.25rem;
  }
  .ihc-sam-cta-actions { align-items: stretch; }
  .ihc-sam-toggle-btn { min-width: 76px; padding: 0.5rem 0.85rem; }
  .ihc-sam-map {
    /* slightly shorter on phones so CTA stays visible */
    height: clamp(360px, 60vh, 500px);
  }
}
@media (max-width: 420px) {
  .ihc-sam-toggle { top: 8px; right: 8px; }
  .ihc-sam-head h1 { font-size: 1.6rem; }
}
