/* =====================================================================
 * Find a Sales Rep — interactive territory map (v1)
 * Hand-written, page-specific stylesheet (not part of the gulp bundle).
 * Brand: red #BC1830, grays; font inherited (Libre Franklin).
 * ===================================================================== */

/* Brand tokens — declared on every top-level section this stylesheet renders.
   NOTE: .srm-worldwide is a SIBLING of .srm (not nested), so it needs the custom
   properties declared on it too; otherwise var(--srm-*) resolves to nothing there
   and colors fall back to the theme (e.g. links go gray instead of brand red). */
.srm,
.srm-worldwide,
.srm-section-divider {
  --srm-red: #BC1830;
  --srm-ink: #1a1a1a;
  --srm-gray: #666666;
  --srm-line: rgba(0, 0, 0, 0.10);
  --srm-bg: #f7f7f7;
  --srm-region: #d8dce1;
  --srm-region-line: #ffffff;
}
.srm { margin: 0 0 2.5rem; }

.srm { scroll-margin-top: 110px; } /* clear the sticky site header when scrolled to (P3#9) */
.srm__intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 0 0 1.5rem;
  scroll-margin-top: 110px;
}
.srm__intro-text { min-width: 0; }
.srm__title {
  margin: 0 0 0.35rem !important;
  color: var(--srm-ink);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.srm__lead { margin: 0; color: var(--srm-gray); font-size: 1rem; line-height: 1.55; max-width: 46rem; }
.srm__lead strong { color: var(--srm-ink); }

/* Reset control (top-right of the module) */
.srm__reset {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--srm-gray);
  background: #fff;
  border: 1px solid var(--srm-line);
  border-radius: 8px; /* match site button radius */
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.srm__reset:hover { border-color: var(--srm-red); color: var(--srm-red); }
.srm__reset:focus-visible { outline: 2px solid var(--srm-red); outline-offset: 2px; }
.srm__reset-icon { font-size: 0.95rem; line-height: 1; }

/* Overlaid on the map (JS relocates the button into .srm__map). Sits bottom-right,
   clear of the top-left zoom controls, with a translucent chip so it reads over the map. */
.srm__reset--overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16);
}
.srm__reset--overlay:hover { background: #fff; }

.srm__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  grid-template-areas:
    "map    panel"
    "legend panel";
  gap: 1.1rem 1.75rem;
  align-items: start;
}

/* ---- Map column ---- */
.srm__mapcol { grid-area: map; min-width: 0; }

.srm__map {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
  min-height: 320px;
  /* faint dot-grid backdrop, echoing the jsVectorMap homepage */
  background:
    radial-gradient(circle, rgba(20, 30, 50, 0.05) 1px, transparent 1.5px) 0 0 / 22px 22px,
    #fcfcfd;
  border: 1px solid var(--srm-line);
  border-radius: 6px;
  overflow: hidden;
}

/* Rep-identity dots: one per state (JVM-style), colored by rep. */
.srm-dot {
  stroke: #ffffff;
  stroke-width: 1;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}
.srm-dot--active   { stroke: #1a1a1a; stroke-width: 1.4; }
.srm-dot--selected { stroke: #1a1a1a; stroke-width: 1.7; }
.srm__map svg { display: block; }

/* jsVectorMap region defaults + interaction */
.srm__map .jvm-region { cursor: pointer; transition: fill-opacity 0.15s ease; }
.srm__map .jvm-region[data-selected="1"] { stroke: var(--srm-ink); stroke-width: 1.1; }

/* Zoom buttons: enlarge to meet the WCAG 2.5.8 target-size minimum and add a
   visible keyboard focus ring (P1#3). These live inside .srm so vars are OK. */
.srm__map .jvm-zoom-btn {
  width: 30px;
  height: 30px;
  line-height: 26px;
  font-size: 18px;
  border-radius: 4px;
  background: rgba(26, 26, 26, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.srm__map .jvm-zoom-btn:hover { background: rgba(26, 26, 26, 0.9); }
.srm__map .jvm-zoom-btn:focus-visible { outline: 2px solid var(--srm-red); outline-offset: 2px; }
/* jsVectorMap's actual classes are .jvm-zoomin / .jvm-zoomout; its default
   15px/35px tops overlap once the buttons are 30px tall — space them out. */
.srm__map .jvm-zoomin { top: 12px; }
.srm__map .jvm-zoomout { top: 50px; }

/* Tooltip restyle to brand.
   NOTE: jsVectorMap appends .jvm-tooltip to <body>, OUTSIDE the .srm scope,
   so CSS custom properties (--srm-*) are NOT available here — use literal
   colors, otherwise var() resolves to nothing and the background goes
   transparent (white text on the light map = invisible). */
.jvm-tooltip.srm-tip {
  background: #1a1a1a !important;
  color: #ffffff !important;
  border: 0;
  border-radius: 4px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.jvm-tooltip.srm-tip .srm-tip__name { font-weight: 700; display: block; color: #ffffff; }
.jvm-tooltip.srm-tip .srm-tip__rep { display: block; color: #e6e6e6; margin-top: 1px; }

/* ---- Legend ---- */
.srm__legend {
  grid-area: legend;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.srm__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.66rem 0.34rem 0.46rem;
  font-size: 0.8rem;
  color: var(--srm-ink);
  background: #fff;
  border: 1px solid var(--srm-line);
  border-radius: 8px; /* site button radius ($global-radius); not a full pill */
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.srm__legend-item:hover { border-color: var(--srm-red); color: var(--srm-red); }
.srm__legend-item[aria-pressed="true"] {
  border-color: var(--srm-red);
  color: var(--srm-red);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--srm-red); /* reads as a bolder red outline when active */
}
.srm__legend-item:focus-visible { outline: 2px solid var(--srm-red); outline-offset: 2px; }

/* A legend KEY, not an actionable filter — no pointer, no hover affordance. */
.srm__legend-item--static,
.srm__legend-item--static:hover {
  cursor: default;
  border-style: dashed;
  border-color: var(--srm-line);
  color: var(--srm-gray);
  background: transparent;
  box-shadow: none;
}
.srm__legend-swatch {
  width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.srm__legend-swatch--split {
  background-image: repeating-linear-gradient(45deg, #9d9d9c 0 3px, #cfcfcf 3px 6px);
}

/* ---- Detail panel ---- */
.srm__panel {
  grid-area: panel;
  position: sticky;
  top: 1.25rem;
  background: #fff;
  border: 1px solid var(--srm-line);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
.srm__panel-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--srm-line);
}
.srm__panel-eyebrow {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--srm-red);
  font-weight: 700;
  margin: 0 0 0.2rem;
}
.srm__panel-title { margin: 0 !important; font-size: 1.2rem; line-height: 1.25; color: var(--srm-ink); font-weight: 700; text-transform: none; letter-spacing: 0; }
.srm__panel-region { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--srm-gray); }
.srm__panel-body { padding: 1rem 1.25rem 1.25rem; }

.srm__hint { color: var(--srm-gray); font-size: 0.9rem; line-height: 1.5; margin: 0; }
.srm__hint strong { color: var(--srm-ink); }

/* Default-state summary stat (fills the empty panel before a selection). */
.srm__stat {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.1rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--srm-line);
}
.srm__stat-num { font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--srm-red); }
.srm__stat-label { font-size: 0.82rem; line-height: 1.35; color: var(--srm-gray); }

/* Rep block(s) inside panel */
.srm__rep { border-left: 3px solid var(--srm-red); padding-left: 0.9rem; margin: 0 0 1rem; }
.srm__rep:last-child { margin-bottom: 0; }
.srm__rep-sub {
  display: inline-block;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: var(--srm-gray);
  padding: 0.12rem 0.45rem; border-radius: 3px; margin: 0 0 0.35rem;
}
.srm__rep-name { margin: 0 0 0.1rem; font-weight: 700; color: var(--srm-ink); font-size: 1rem; }
.srm__rep-role { margin: 0 0 0.4rem; font-size: 0.82rem; color: var(--srm-gray); }
.srm__rep-contact { list-style: none; margin: 0.35rem 0 0; padding: 0; font-size: 0.85rem; }
.srm__rep-contact li { margin: 0.15rem 0; }
.srm__rep-contact a { color: var(--srm-red); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.srm__rep-contact a:hover { text-decoration-thickness: 2px; }
.srm__rep-missing { font-size: 0.82rem; color: var(--srm-gray); font-style: italic; }

.srm__rcl { margin: 1rem 0 0; padding: 0.85rem 0 0; border-top: 1px dashed var(--srm-line); }
.srm__rcl-label { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--srm-gray); font-weight: 700; margin: 0 0 0.35rem; }
.srm__rcl-item { font-size: 0.85rem; color: var(--srm-ink); margin: 0.1rem 0; }
.srm__rcl-item span { color: var(--srm-gray); }

.srm__panel-list { list-style: none; margin: 0.5rem 0 0; padding: 0; columns: 2; font-size: 0.82rem; color: var(--srm-gray); }
.srm__panel-list li { margin: 0.1rem 0; break-inside: avoid; }

/* Accessible region selector (mobile / keyboard). Lives OUTSIDE .srm__panel-body
   (which the JS re-renders via innerHTML) and sits at the BOTTOM of the panel as
   a footer, so the territory → rep → contact details read as one uninterrupted block. */
.srm__select-wrap { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid var(--srm-line); }
.srm__select-wrap label { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--srm-gray); font-weight: 700; margin: 0 0 0.3rem; }
/* The arrow is drawn on the wrapper (::after), NOT as a select background-image.
   The theme sets its own `select { background-image: <gray triangle> }`, and
   background positioning on a styled <select> is unreliable across browsers — a
   wrapper pseudo-element sits flush to the right on every engine. */
.srm__select-shell { position: relative; display: block; }
.srm__select-shell::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.85rem;                 /* flush to the right edge, with a little padding */
  transform: translateY(-50%);    /* exact vertical centering (triangle box is 6px tall) */
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--srm-red);
  pointer-events: none;           /* clicks pass through to the select */
}
.srm__select {
  display: block;                 /* remove inline descender so the shell height == select height (arrow centers) */
  width: 100%; padding: 0.6rem 2.2rem 0.6rem 0.8rem; font-size: 0.9rem; font-family: inherit;
  /* Truncate rather than run the value text under the arrow on narrow widths */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid var(--srm-line); border-radius: 6px; color: var(--srm-ink);
  /* Distinct tinted fill so the control reads as an interactive field, not page background */
  background-color: #eef1f5;
  /* Strip the theme's default select arrow so ours (on the wrapper) is the only one */
  background-image: none;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  cursor: pointer;
}
.srm__select:hover { border-color: rgba(188, 24, 48, 0.45); }
.srm__select:focus { outline: none; border-color: var(--srm-red); box-shadow: 0 0 0 3px rgba(188, 24, 48, 0.12); }

/* ---- SKETCH: Option 3 office/production-site pin layer ---- */
.srm-pin { cursor: pointer; transition: opacity 0.12s ease; }
.srm-pin--sales { fill: var(--srm-red); stroke: #fff; stroke-width: 1.2; }
.srm-pin--prod  { fill: rgba(255,255,255,0.55); stroke: var(--srm-red); stroke-width: 2.4; }
.srm-pin:hover { opacity: 0.75; }

.srm-pinbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  margin: 0.7rem 0 0;
  font-size: 0.8rem;
  color: var(--srm-gray);
}
.srm-pinbar__label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; }
.srm-pinbar label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; line-height: 1; }
/* Larger, brand-colored checkboxes, vertically centered with the key + text */
.srm-pinbar input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; flex: 0 0 auto;
  accent-color: var(--srm-red); cursor: pointer;
}
.srm-pin-key { width: 13px; height: 13px; display: inline-block; flex: 0 0 auto; }
.srm-pin-key--sales { background: var(--srm-red); box-shadow: inset 0 0 0 1px #fff; }
.srm-pin-key--prod  { border: 2px solid var(--srm-red); border-radius: 50%; }
/* On narrow screens, stack the two options so their checkboxes align in a column */
@media (max-width: 640px) {
  .srm-pinbar { align-items: flex-start; }
  .srm-pinbar__label { flex: 1 0 100%; }
  .srm-pinbar label { flex: 1 0 100%; }
}

/* ---- Worldwide contacts list (country -> rep) ---- */
.srm-worldwide { margin: 0 0 2.5rem; scroll-margin-top: 110px; }
.srm-worldwide__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
  /* Divider anchors the header band so the search field doesn't read as floating */
  margin: 0 0 1.5rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--srm-line);
}
.srm-worldwide__title { margin: 0 0 0.3rem !important; color: var(--srm-ink); font-weight: 700; text-transform: none; letter-spacing: 0; }
.srm-worldwide__lead { margin: 0; color: var(--srm-gray); font-size: 1rem; line-height: 1.5; }
.srm-worldwide__search { flex: 0 0 auto; }
.srm-worldwide__search label { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--srm-gray); font-weight: 700; margin: 0 0 0.3rem; }
/* Desktop (3-column list): match the search field to one column width and pin it
   right, so its left edge lines up with the third column of the list below. */
@media (min-width: 901px) {
  .srm-worldwide__search { width: calc((100% - 4.5rem) / 3); }
  .srm-worldwide__input { width: 100%; }
}
.srm-worldwide__input {
  width: 280px; max-width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.4rem;
  font: inherit; font-size: 0.9rem;
  color: var(--srm-ink);
  border: 1px solid var(--srm-line);
  border-radius: 8px;
  /* Tinted fill + magnifier icon so it's unmistakably a search box on any screen */
  background-color: #eef1f5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.8rem center;
}
.srm-worldwide__input::placeholder { color: #7a828c; }
.srm-worldwide__input:focus { outline: none; border-color: var(--srm-red); box-shadow: 0 0 0 3px rgba(188, 24, 48, 0.12); background-color: #fff; }

.srm-worldwide__list {
  list-style: none; margin: 0; padding: 0;
  columns: 3; column-gap: 2.25rem;
}
.srm-ww-item {
  break-inside: avoid;
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.srm-ww-country { font-weight: 600; color: var(--srm-ink); font-size: 0.9rem; }
.srm-ww-rep { font-size: 0.82rem; color: var(--srm-gray); }
.srm-ww-rep--none { font-style: italic; }
/* Red link color (site standard), no default underline. Elevated specificity +
   !important because a global stylesheet otherwise grays these anchors. */
.srm-worldwide .srm-ww-contact a,
.srm-worldwide .srm-ww-contact a:link,
.srm-worldwide .srm-ww-contact a:visited { color: var(--srm-red) !important; text-decoration: none; }
.srm-worldwide .srm-ww-contact a:hover { text-decoration: underline; text-underline-offset: 2px; }
.srm-ww-sep { color: rgba(0, 0, 0, 0.25); margin: 0 0.15rem; }
.srm-worldwide__empty { color: var(--srm-gray); font-size: 0.9rem; margin: 0.5rem 0 0; }

@media (max-width: 900px) { .srm-worldwide__list { columns: 2; } }
@media (max-width: 600px) { .srm-worldwide__list { columns: 1; } .srm-worldwide__input { width: 100%; } }

/* Divider between the map module and the legacy office directory (P3#8). */
.srm-section-divider {
  max-width: 1200px;
  margin: 0.5rem auto 2.25rem;
  padding: 0 0.9375rem;
}
.srm-section-divider hr {
  border: 0;
  border-top: 1px solid var(--srm-line, rgba(0, 0, 0, 0.1));
  margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  /* Order: map -> panel (the result) -> legend, so a tapped state's result
     appears directly under the map instead of below the legend. */
  .srm__layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "panel"
      "legend";
    gap: 1.1rem;
  }
  .srm__panel { position: static; }
  .srm__map { aspect-ratio: 4 / 3; }
}
