/* Panda Exteriors — animated "areas we serve" map (see README.md in this folder).
   Everything is scoped to .pmap / .pmap-* so the site's own styles are untouched. */

.pmap {
  --pmap-land: #eceef1;
  --pmap-border: #ffffff;
  --pmap-served: #f26924;
  --pmap-served-stroke: #b9491a;
  --pmap-pin: #111111;
  --pmap-pin-ring: #ffffff;
  --pmap-pulse: #9acd32;
  --pmap-ink: #111111;
  --pmap-ink-2: #4b5563;
  --pmap-inset-bg: #ffffff;
  --pmap-inset-frame: #d1d5db;
  /* States shaded by jobs completed, fewest (t1) to most (t5); see "jobTiers" in areas.json. */
  --pmap-t1: #f98e52;
  --pmap-t2: #e97125;
  --pmap-t3: #cf5d03;
  --pmap-t4: #af4e05;
  --pmap-t5: #8d400c;
  --pmap-tier-stroke: #ffffff;
  position: relative;
  width: 100%;
  color: var(--pmap-ink);
  font-family: var(--robboto, Roboto), system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  text-align: left;
}
/* On the orange band: the country in a deeper orange, served states lit in white
   (the more jobs, the whiter). */
.pmap--on-orange {
  --pmap-land: #c14f02;
  --pmap-border: rgba(255, 255, 255, 0.4);
  --pmap-served: #fff8f2;
  --pmap-served-stroke: #f26924;
  --pmap-ink: #ffffff;
  --pmap-inset-bg: var(--seconday, #f26924);
  --pmap-inset-frame: rgba(255, 255, 255, 0.6);
  --pmap-t1: #e69469;
  --pmap-t2: #efad8c;
  --pmap-t3: #f5c7af;
  --pmap-t4: #fbe0d2;
  --pmap-t5: #fef9f7;
  --pmap-tier-stroke: var(--pmap-served-stroke);
}

/* ---------------------------------------------------------------- the map */
.pmap__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
}
.pmap .pmap__svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  overflow: hidden;
}
.pmap__land {
  fill: var(--pmap-land);
}
/* The map fades out at its edges instead of ending in a hard rectangle. */
.pmap .pmap__svg {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}
/* The whole country in view (served states from coast to coast): nothing is cut off at
   the edges, so no fade (it comes back while the large map is zoomed into a state), and
   the small map's frame takes the map's own shape instead of leaving bands of space. */
.pmap--whole:not(.pmap--has-selection) .pmap__svg {
  -webkit-mask-image: none;
  mask-image: none;
}
.pmap--whole.pmap--compact .pmap__stage {
  aspect-ratio: var(--pmap-aspect, 8 / 5);
}
.pmap--whole.pmap--explorer .pmap__stage {
  aspect-ratio: 3 / 2;
}
.pmap__borders {
  fill: none;
  stroke: var(--pmap-border);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.pmap__state {
  fill: var(--pmap-served);
  stroke: var(--pmap-served-stroke);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.pmap__state--t1,
.pmap__state--t2,
.pmap__state--t3,
.pmap__state--t4,
.pmap__state--t5 {
  stroke: var(--pmap-tier-stroke);
}
.pmap__state--t1 {
  fill: var(--pmap-t1);
}
.pmap__state--t2 {
  fill: var(--pmap-t2);
}
.pmap__state--t3 {
  fill: var(--pmap-t3);
}
.pmap__state--t4 {
  fill: var(--pmap-t4);
}
.pmap__state--t5 {
  fill: var(--pmap-t5);
}
/* Markers are drawn in screen pixels (the script scales them to the zoom level). */
.pmap__area {
  cursor: pointer;
  outline: none;
}
.pmap__pin,
.pmap__pulse {
  transform-box: fill-box;
  transform-origin: center;
}
.pmap__hit {
  fill: transparent;
}
.pmap__dot {
  fill: var(--pmap-pin);
  stroke: var(--pmap-pin-ring);
  stroke-width: 2.5;
  transition: stroke 0.15s ease;
}
.pmap__pulse {
  fill: none;
  stroke: var(--pmap-pulse);
  stroke-width: 3;
  opacity: 0;
}
.pmap__count {
  fill: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}
.pmap__area:hover .pmap__dot,
.pmap__area:focus-visible .pmap__dot,
.pmap__area.is-active .pmap__dot {
  stroke: var(--pmap-pulse);
  stroke-width: 4;
}

/* A state far from the others (Florida) sits in a small framed box in the corner,
   so the map doesn't have to zoom out for it. */
.pmap__inset {
  position: absolute;
  z-index: 1;
  right: 1.5%;
  bottom: 2%;
  width: min(25%, 200px);
  aspect-ratio: var(--pmap-inset-aspect, 1);
  border: 1.5px solid var(--pmap-inset-frame);
  border-radius: 12px;
  background: var(--pmap-inset-bg);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.pmap .pmap__inset-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  overflow: hidden;
}
.pmap__inset-name {
  position: absolute;
  left: 9px;
  bottom: 6px;
  color: var(--pmap-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

/* --------------------------------------------------------------- tooltip */
.pmap__tip {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 16px));
  padding: 8px 12px;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.pmap [hidden],
.pmap__tip[hidden] {
  display: none !important;
}
.pmap__tip strong {
  color: #ffffff;
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.pmap__tip span {
  display: block;
  color: #d1d5db;
  font-size: 13px;
}
.pmap__tip::after {
  content: "";
  position: absolute;
  left: var(--pmap-tip-arrow, 50%);
  bottom: -5px;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  background: inherit;
  border-radius: 2px;
  transform: rotate(45deg);
}

/* ---------------------------------------------------------------- legend */
.pmap .pmap__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 0 0;
  padding: 0;
  color: var(--pmap-ink);
  font-size: 14px;
  line-height: 1.4;
}
.pmap--on-orange .pmap__legend {
  display: inline-flex;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.88);
}
.pmap--on-orange .pmap__legend--scale {
  align-items: center;
  padding: 10px 16px;
  border-radius: 14px;
}
.pmap .pmap__legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pmap__key {
  display: inline-block;
  flex: none;
}
.pmap__key--state {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  background: var(--pmap-served);
  box-shadow: inset 0 0 0 1px var(--pmap-served-stroke);
}
/* The jobs scale: a title over a row of swatches, each labelled with its band. */
.pmap .pmap__legend-item--scale {
  display: block;
}
.pmap__legend-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}
.pmap__scale {
  display: grid;
  grid-auto-columns: minmax(50px, 60px);
  grid-auto-flow: column;
  column-gap: 2px;
}
.pmap__scale-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.pmap__scale-step .pmap__key {
  width: 100%;
  height: 10px;
}
.pmap__scale-step:first-child .pmap__key {
  border-radius: 3px 0 0 3px;
}
.pmap__scale-step:last-child .pmap__key {
  border-radius: 0 3px 3px 0;
}
.pmap__key--t1 {
  background: var(--pmap-t1);
}
.pmap__key--t2 {
  background: var(--pmap-t2);
}
.pmap__key--t3 {
  background: var(--pmap-t3);
}
.pmap__key--t4 {
  background: var(--pmap-t4);
}
.pmap__key--t5 {
  background: var(--pmap-t5);
}
.pmap__key--office {
  width: 11px;
  height: 11px;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--pmap-pin);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--pmap-pulse);
}

/* ------------------------------------------------------------- animation
   The script adds pmap--armed as soon as it runs (map at the whole-US view, states
   unlit, markers hidden), then pmap--play / --lit / --pins / --idle as the section
   scrolls into view. Without the script the map simply shows its final state. */
.pmap--armed .pmap__svg {
  opacity: 0;
}
.pmap--armed .pmap__state {
  opacity: 0;
}
.pmap--armed .pmap__pin {
  opacity: 0;
  transform: scale(0);
}
.pmap--play .pmap__svg {
  opacity: 1;
  transition: opacity 0.6s ease;
}
.pmap--lit .pmap__state {
  opacity: 1;
  transition: opacity 0.7s ease calc(var(--i, 0) * 110ms);
}
.pmap--pins .pmap__pin {
  opacity: 1;
  transform: scale(1);
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i, 0) * 130ms),
    opacity 0.2s linear calc(var(--i, 0) * 130ms);
}
.pmap--armed .pmap__inset {
  opacity: 0;
  transform: translateY(6px);
}
.pmap--pins .pmap__inset {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.pmap--idle .pmap__pulse {
  animation: pmap-pulse 3s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
  animation-delay: calc(var(--i, 0) * 500ms);
}
@keyframes pmap-pulse {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  75%,
  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

/* ------------------------------------------------ explorer (large) version */
.pmap--explorer .pmap__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.pmap .pmap__chip {
  appearance: none;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pmap .pmap__chip:hover {
  border-color: #111111;
}
.pmap .pmap__chip[aria-pressed="true"] {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}
.pmap .pmap__chip:focus-visible,
.pmap .pmap__cta:focus-visible {
  outline: 3px solid #f26924;
  outline-offset: 2px;
}
.pmap--explorer .pmap__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: center;
}
.pmap--explorer .pmap__stage {
  aspect-ratio: 4 / 3;
}
.pmap--explorer .pmap__state {
  cursor: pointer;
}
.pmap--explorer.pmap--has-selection .pmap__state {
  opacity: 0.45;
}
.pmap--explorer.pmap--has-selection .pmap__state.is-selected {
  opacity: 1;
}
.pmap--explorer.pmap--has-selection .pmap__area:not(.is-selected) {
  opacity: 0.35;
}
/* While another state is zoomed in, the inset steps aside. */
.pmap--explorer.pmap--has-selection .pmap__inset:not(.is-selected) {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.pmap__info {
  padding: 22px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f9fafb;
}
.pmap__info p {
  margin: 0;
  padding: 0;
}
.pmap .pmap__info-title {
  margin-bottom: 6px;
  color: #111111;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}
.pmap .pmap__info-text {
  margin-bottom: 14px;
  color: var(--pmap-ink-2);
  font-size: 16px;
  line-height: 1.5;
}
.pmap .pmap__info-offices {
  margin-bottom: 20px;
  color: #111111;
  font-size: 15px;
  line-height: 1.5;
}
.pmap .pmap__info-offices[hidden] {
  display: none;
}
.pmap__info-label {
  display: block;
  margin-bottom: 2px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pmap .pmap__info-jobs {
  margin-bottom: 18px;
  color: #111111;
  font-size: 18px;
  font-weight: 700;
}
.pmap .pmap__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.pmap .pmap__cta:hover {
  background: #333333;
  color: #ffffff;
}

@media (max-width: 991px) {
  .pmap--explorer .pmap__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
}
@media (max-width: 767px) {
  .pmap__stage,
  .pmap--explorer .pmap__stage {
    aspect-ratio: 1 / 1;
  }
  .pmap--whole.pmap--explorer .pmap__stage {
    aspect-ratio: 4 / 3;
  }
  .pmap .pmap__chip {
    flex: none;
    padding: 9px 14px;
    font-size: 14px;
    white-space: nowrap;
  }
  /* One row of state buttons that scrolls sideways, instead of many rows. */
  .pmap--explorer .pmap__chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* room for the focus ring, and a fade at the edge hinting at more buttons */
    margin-left: -4px;
    margin-right: -4px;
    padding: 4px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .pmap--explorer .pmap__chips::-webkit-scrollbar {
    display: none;
  }
  .pmap--explorer .pmap__chips.is-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* ------------------------------------------- page sections that hold a map */
/* The orange "Local East Coast Exterior Remodelers" band (it used to be a picture). */
.pmap-section--orange {
  background-color: var(--seconday, #f26924);
}
.pmap-section .image-container {
  width: 100%;
  max-width: 640px;
}
/* Blocks added around the large map use the same font as the map. */
.pmap-block,
.pmap-projects {
  font-family: var(--robboto, Roboto), system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
/* White card around the large map (Service Areas, Past Projects). */
.pmap-card {
  margin-top: 8px;
  padding: clamp(16px, 3vw, 32px);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}
.pmap-block {
  padding: 8px 0 48px;
}
.pmap-block .pmap-block__intro {
  margin: 0 0 20px;
  color: #4b5563;
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
}
.pmap-block + .pmap-block {
  padding-top: 24px;
}
/* Featured projects grid on Past Projects. */
.pmap-projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.pmap-projects a {
  display: block;
  height: 100%;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  color: #111111;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pmap-projects a:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}
.pmap-projects a:focus-visible {
  outline: 3px solid #f26924;
  outline-offset: 2px;
}
.pmap-projects .pmap-projects__item img {
  display: block;
  width: 100%;
  /* the site forces .breakdance img { height: 100% !important } */
  height: auto !important;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f3f4f6;
}
.pmap-projects span {
  display: block;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
  .pmap *,
  .pmap-projects a {
    animation: none !important;
    transition: none !important;
  }
}
