/**
 * Stout Roofing — Leaflet CSS Overrides (M9)
 *
 * Must load AFTER Leaflet.css and MarkerCluster.Default.css.
 * Enqueued by inc/enqueues.php only on the job map page.
 *
 * Design tokens:
 *   Navy  #1B2A4A  (primary)
 *   Gold  #D4A843  (accent)
 *   Red   #C8102E  (CTA / default marker)
 *
 * @see design/mockups/Our_Work/01_job_map.html (reference implementation)
 */

/* ── Cluster markers — branded color scale ───────────────────────────────── */
/* Small (< 10 jobs): gold */
.marker-cluster-small {
  background-color: rgba(212, 168, 67, 0.6);
}
.marker-cluster-small div {
  background-color: rgba(212, 168, 67, 0.9);
  color: #1B2A4A;
}

/* Medium (10–49 jobs): navy */
.marker-cluster-medium {
  background-color: rgba(27, 42, 74, 0.6);
}
.marker-cluster-medium div {
  background-color: rgba(27, 42, 74, 0.9);
  color: #fff;
}

/* Large (50+ jobs): red */
.marker-cluster-large {
  background-color: rgba(200, 16, 46, 0.6);
}
.marker-cluster-large div {
  background-color: rgba(200, 16, 46, 0.9);
  color: #fff;
}

/* Cluster inner div — shared typography */
.marker-cluster div {
  width: 34px;
  height: 34px;
  margin-left: 3px;
  margin-top: 3px;
  text-align: center;
  border-radius: 50%;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 34px;
}

/* ── Custom marker dots ──────────────────────────────────────────────────── */
/* Rendered by L.divIcon; preferCanvas=true means these are DOM overlays */
.stout-marker {
  border-radius: 50%;
  border: 3px solid #1B2A4A;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 120ms ease;
}

.stout-marker--default {
  width: 16px;
  height: 16px;
  background: #C8102E;
}

.stout-marker--active {
  width: 20px;
  height: 20px;
  background: #D4A843;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Popup wrapper ───────────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(27, 42, 74, 0.2);
}

.leaflet-popup-content {
  margin: 0;
  min-width: 260px;
}

.leaflet-popup-close-button {
  color: #757575 !important;
  font-size: 20px !important;
  top: 8px !important;
  right: 10px !important;
  z-index: 10;
}

.leaflet-popup-close-button:hover,
.leaflet-popup-close-button:focus {
  color: #1B2A4A !important;
}

/* ── Popup card content ──────────────────────────────────────────────────── */
.stout-map-popup {
  animation: stout-popup-in 200ms ease;
}

@keyframes stout-popup-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1);   }
}

.stout-map-popup__img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.stout-map-popup__body {
  padding: 12px 16px;
}

.stout-map-popup__title {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  color: #1B2A4A;
  font-size: 15px;
  margin: 0 0 4px;
  line-height: 1.3;
}

.stout-map-popup__location {
  color: #757575;
  font-size: 13px;
  margin: 0 0 8px;
}

.stout-map-popup__dl {
  font-size: 13px;
  color: #4A4A4A;
  line-height: 1.6;
  margin: 0 0 10px;
}

.stout-map-popup__dl div {
  display: flex;
  gap: 4px;
}

.stout-map-popup__dl dt {
  font-weight: 700;
  flex-shrink: 0;
}


.stout-map-popup__cta {
  display: block;
  text-align: center;
  background: #C8102E;
  color: #fff;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.stout-map-popup__cta:hover,
.stout-map-popup__cta:focus {
  background: #A50D24;
  color: #fff;
}

/* Loading / error states */
.stout-map-popup--loading,
.stout-map-popup--error {
  padding: 24px 16px;
  text-align: center;
  min-width: 200px;
}

.stout-map-popup__spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #E8E8E3;
  border-top-color: #1B2A4A;
  border-radius: 50%;
  animation: stout-spin 700ms linear infinite;
}

@keyframes stout-spin {
  to { transform: rotate(360deg); }
}

/* ── Home button control ─────────────────────────────────────────────────── */
.leaflet-control-home {
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  cursor: pointer;
}

.leaflet-control-home a {
  display: block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 16px;
  color: #333;
  text-decoration: none;
}

.leaflet-control-home a:hover,
.leaflet-control-home a:focus {
  background: #f4f4f4;
  color: #1B2A4A;
}

/* ── Focus-visible for all Leaflet interactive elements ──────────────────── */
.leaflet-interactive:focus-visible,
.leaflet-control a:focus-visible {
  outline: 2px solid #1B2A4A;
  outline-offset: 2px;
}

/* ── Reduce motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .stout-map-popup,
  .stout-marker,
  .leaflet-fade-anim .leaflet-tile,
  .leaflet-zoom-animated {
    animation: none !important;
    transition: none !important;
  }
}
