/* ============================================================
   LAW interactive maps
   Upload to /wp-content/uploads/law-maps/law-maps.css

   TO ADJUST THE BACKGROUND SHADE, edit the four values in the
   block below and nothing else. They are the only colours that
   control how dark the map field reads.
   ============================================================ */

/* ---------- container defence ----------
   The theme wraps shortcode output in its own columns. These rules
   stop the map inheriting a float, a narrow column or a shrink. */

.law-mapwrap {
  width: 100%;
  max-width: 100%;
  float: none;
  clear: both;
  margin-left: 0;
  margin-right: 0;

  /* The theme's body font is a serif and inherits straight into the
     map. Both faces are the ones named in LAW's brand guide; if the
     theme does not load them, the system sans is a close fallback —
     what matters is that nothing here renders as a serif. */
  --law-font-sans: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --law-font-display: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  font-family: var(--law-font-sans);
}
.law-mapwrap p,
.law-mapwrap span,
.law-mapwrap a,
.law-mapwrap button,
.law-mapwrap dt,
.law-mapwrap dd { font-family: var(--law-font-sans); }

.law-mapwrap h2,
.law-mapwrap h3 { font-family: var(--law-font-display); }

/* Themes hang decorative rules, bars and generous margins off
   headings. Inside the map that produces stray gaps and lines. */
.law-mapwrap h2,
.law-mapwrap h3,
.law-mapwrap p {
  margin: 0;
  padding: 0;
  border: 0;
  text-align: left;
}
.law-mapwrap h2::before, .law-mapwrap h2::after,
.law-mapwrap h3::before, .law-mapwrap h3::after { content: none; }
.law-mapwrap,
.law-mapwrap *,
.law-mapwrap *::before,
.law-mapwrap *::after { box-sizing: border-box; }

/* Escape the theme's content column entirely — added by
   [law_where_we_work full="yes"].

   The usual calc(50% - 50vw) trick assumes the wrapper's container
   is itself centred in the viewport. This theme's is not, which
   left a gap down one side. So the real offset is measured in JS
   (see lawFullBleed) and written to --law-bleed-left; this rule is
   only the pre-script fallback. */
.law-mapwrap--full {
  width: var(--law-bleed-width, 100vw);
  max-width: none;
  margin-left: var(--law-bleed-left, calc(50% - 50vw));
  margin-right: 0;
}

.law-field {
  /* Option B — lightened from the original mockup, which the team
     found too dark. Option A (as mockup): #141d76 / #0a1460 /
     #060d3d with land 0.16. Option C (lightest): #2a35a5 /
     #1d288f / #141d76 with land rgba(168,177,235,0.34). */
  --law-map-bg-1: #1d288f;
  --law-map-bg-2: #141d76;
  --law-map-bg-3: #0a1460;
  --law-map-land: rgba(141, 150, 218, 0.26);

  --law-red: #e31140;
  --law-red-hover: #c80f38;
  --law-red-500: #ec2f5a;
  --law-navy-100: #e0e3f6;
  --law-navy-200: #b9beea;
  --law-navy-300: #8d96da;
  --law-navy-800: #0a1460;

  /* The section itself is the deepest navy. The gradient belongs to
     the panel inset within it — merging the two is what made this
     read as a flat, over-bright block. */
  background: var(--law-navy-900, #060d3d);
  color: #fff;
  padding: 8px 64px 64px;
}

.law-panel {
  background: radial-gradient(120% 130% at 18% 8%,
    var(--law-map-bg-1) 0%, var(--law-map-bg-2) 42%, var(--law-map-bg-3) 100%);
  border: 1px solid rgba(141, 150, 218, .18);
  border-radius: 4px;
  overflow: hidden;
}

/* ---------- title band ----------
   The red bar down the left edge is LAW's signature device; it runs
   the full height of the text block, not just the heading. */

.law-head { padding: 46px 50px 34px; }
.law-head--light { background: #fff; }

/* Inside .law-field, which already supplies the horizontal padding. */
.law-head--dark { background: transparent; padding: 48px 0 30px; }

.law-head__bar {
  border-left: 6px solid var(--law-red, #e31140);
  padding-left: 26px;
}

/* Title left, intro right — as in the design. Stacks below 900px. */
.law-head--dark .law-head__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  grid-template-areas:
    'eyebrow intro'
    'title   intro';
  column-gap: 40px;
  align-items: center;
}
.law-head--dark .law-head__eyebrow { grid-area: eyebrow; margin-bottom: 8px; }
.law-head--dark .law-head__title { grid-area: title; margin-bottom: 0; }
.law-head--dark .law-head__intro { grid-area: intro; align-self: center; }

@media (max-width: 900px) {
  .law-head--dark .law-head__bar {
    display: block;
  }
  .law-head--dark .law-head__title { margin-bottom: 12px; }
}

.law-mapwrap .law-head__eyebrow {
  margin: 0 0 12px;
  padding: 0;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--law-red, #e31140);
}

.law-mapwrap .law-head__title {
  margin: 0 0 12px;
  padding: 0;
  font-weight: 800;
  font-size: 42px;
  line-height: 1.02;
  letter-spacing: -.03em;
  text-transform: none;
  color: var(--law-navy-800, #0a1460);
}
.law-mapwrap .law-head__title::before,
.law-mapwrap .law-head__title::after { content: none; }
.law-mapwrap .law-head--dark .law-head__title { color: #fff; }

.law-mapwrap .law-head__intro {
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #5d6275;
  max-width: 620px;
}
.law-mapwrap .law-head--dark .law-head__intro { color: var(--law-navy-200, #b9beea); }

.law-mapwrap .law-head .law-toggle { margin: 26px 0 0; }

/* ---------- map surface ---------- */

.law-map { position: relative; }

.law-map__svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  /* The viewBox is 640×356, so at full-bleed width the map would
     render over 1000px tall and push everything below the fold.
     Capping the height letterboxes it instead, keeping it centred. */
  max-height: 68vh;
}

.law-map__pin { cursor: pointer; }
.law-map__pin circle { transition: r .18s ease, fill .18s ease; }
.law-map__pin:focus { outline: none; }
.law-map__pin:focus-visible circle:last-child {
  stroke: #fff;
  stroke-width: 2.4;
}

.law-map__error { padding: 24px; color: var(--law-navy-200); font-size: 14px; }

.law-map__controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

/* The theme gives buttons a bottom margin, which the flex `gap`
   then adds to — hence the oversized spacing. Zero it explicitly. */
.law-map__controls .law-map__ctrl {
  margin: 0;
  min-width: 0;
  min-height: 0;
  flex: none;
  /* A theme line-height taller than the button pushes the glyph
     off-centre; 1 keeps the flex centring honest. */
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}

.law-map__ctrl {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(141, 150, 218, .4);
  background: rgba(6, 13, 61, .72);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background .15s;
}
.law-map__ctrl:hover,
.law-map__ctrl:focus-visible { background: var(--law-red); color: #fff; }

/* Themes commonly restyle svgs inside buttons — force our own size
   and make the icon follow the button's text colour. The reset icon
   is stroke-only, so a theme setting `fill` alone leaves it blank. */
.law-map__ctrl svg {
  display: block;
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
  fill: none;
  stroke: currentColor;
  vertical-align: middle;
}

/* ---------- legend ---------- */

.law-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.law-legend__region {
  width: 100%;
  margin: 14px 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--law-navy-200);
}
.law-legend__region:first-child { margin-top: 0; }

.law-legend__label {
  font-size: 12px;
  color: var(--law-navy-300);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}
.law-legend__label i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--law-red);
  flex: none;
}

.law-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(141, 150, 218, .10);
  border: 1px solid rgba(141, 150, 218, .22);
  transition: border-color .15s, background .15s;
}
.law-chip i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--law-navy-300);
  flex: none;
}
.law-chip:hover,
.law-chip:focus-visible,
.law-chip[aria-current="true"] {
  border-color: var(--law-red);
  background: rgba(227, 17, 64, .18);
}
.law-chip[aria-current="true"] i { background: var(--law-red); }

/* ---------- map 1: Where We Work ---------- */

.law-wwm {
  display: grid;
  /* minmax(0,1fr) — a bare 1fr refuses to shrink below the SVG's
     intrinsic width and the whole grid overflows its container. */
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 560px;
}

.law-wwm__main {
  position: relative;
  min-width: 0;
  padding: 40px 20px 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.law-wwm__main .law-legend { margin-top: 24px; }

.law-wwm__side {
  background: transparent;
  border-left: 1px solid rgba(141, 150, 218, .18);
  padding: 32px 30px;
  display: flex;
  flex-direction: column;
}

.law-eyebrow {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--law-red-500);
}

.law-wwm__panel {
  margin-top: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.law-wwm__prompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px dashed rgba(141, 150, 218, .3);
  border-radius: 4px;
  padding: 28px 22px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--law-navy-200);
}

.law-wwm__card { display: flex; flex-direction: column; }

/* Fixed shape rather than flex:1. In a tall panel, flex:1 let the
   image box grow to several hundred pixels, which is what produced
   the large empty area under the photo. */
.law-wwm__img {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 16 / 10;
  width: 100%;
  min-height: 180px;
  max-height: 320px;
  background: var(--law-navy-100);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

/* Absolutely positioned with all four insets pinned, so the image
   fills the panel even under a theme reset of `img { height: auto }`
   — which otherwise leaves a band of background below it. */
.law-wwm__img img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Countries with no image yet: let the text take the space rather
   than leaving a hole where the picture would be. */
.law-wwm__card--noimg { justify-content: center; }
.law-wwm__card--noimg h3 { margin-top: 0; }

.law-wwm__card h3 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
  margin: 18px 0 8px;
}
.law-wwm__card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--law-navy-200);
  margin: 0 0 20px;
}

.law-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--law-red);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 4px;
  text-decoration: none;
}
.law-btn:hover { background: var(--law-red-hover); color: #fff; }
.law-btn[aria-disabled="true"] {
  background: rgba(141, 150, 218, .25);
  color: var(--law-navy-200);
  cursor: not-allowed;
}

.law-wwm__tally {
  margin-top: auto;
  padding-top: 22px;
  font-size: 12px;
  color: var(--law-navy-300);
  display: flex;
  align-items: center;
  gap: 8px;
}
.law-wwm__tally i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--law-red);
  flex: none;
}

/* ---------- map 2: Cases ---------- */

/* Scoped under .law-mapwrap throughout: the theme styles bare
   `button` with enough specificity to beat a lone class, which left
   these rendering as plain bold text. */

.law-mapwrap .law-toggle {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.law-mapwrap .law-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin: 0;
  padding: 13px 26px;
  font-family: var(--law-font-sans);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  background-image: none;
  box-shadow: none;
  transition: background .15s, color .15s;
}

.law-mapwrap .law-toggle__btn[data-mode="violation"] {
  border: 2px solid var(--law-red, #e31140);
  color: var(--law-red, #e31140);
}
.law-mapwrap .law-toggle__btn[data-mode="violation"][aria-pressed="true"] {
  background: var(--law-red, #e31140);
  color: #fff;
}
.law-mapwrap .law-toggle__btn[data-mode="case"] {
  border: 2px solid var(--law-navy-800, #0a1460);
  color: var(--law-navy-800, #0a1460);
}
.law-mapwrap .law-toggle__btn[data-mode="case"][aria-pressed="true"] {
  background: var(--law-navy-800, #0a1460);
  color: #fff;
}

.law-cm__map { position: relative; padding: 30px 40px 20px; }
.law-cm__map .law-map__controls { right: 54px; bottom: 34px; }
.law-cm__legend { padding: 6px 40px 26px; }

/* ---------- modal ---------- */

.law-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 13, 61, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.law-modal[hidden] { display: none; }

.law-modal__box {
  background: #fff;
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(6, 13, 61, .5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.law-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 14px;
}
.law-modal__head h3 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--law-navy-800, #0a1460);
  margin: 0;
}

.law-modal__close {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #7b8094;
  font-size: 24px;
  line-height: 1;
}
.law-modal__close:hover { background: #f2f3fb; }

.law-modal__body {
  overflow-y: auto;
  padding: 6px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.law-modal__empty { color: #5d6275; font-size: 15px; line-height: 1.6; margin: 0 0 12px; }

.law-case {
  border: 1px solid #dfe2ee;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 38% 62%;
  font-size: 15px;
  margin: 0;
}
.law-case dt,
.law-case dd { margin: 0; padding: 13px 18px; border-top: 1px solid #dfe2ee; }
.law-case dt { font-weight: 700; color: #0a1460; border-right: 1px solid #dfe2ee; }
.law-case dd { color: #1c2333; }
.law-case dt:first-of-type,
.law-case dt:first-of-type + dd { background: #0a1460; color: #fff; border-top: none; }
.law-case dt:first-of-type { border-right-color: rgba(255, 255, 255, .2); }

/* ---------- responsive ---------- */

/* Below ~1040px the 380px side panel leaves too little for the map,
   so stack rather than squeeze. */
@media (max-width: 1040px) {
  .law-wwm { grid-template-columns: minmax(0, 1fr); }
  .law-wwm__side { border-left: none; border-top: 1px solid rgba(141, 150, 218, .18); }
}

@media (max-width: 860px) {
  .law-wwm { grid-template-columns: 1fr; }
  .law-wwm__main { padding: 24px 20px; }
  .law-wwm__side {
    border-left: none;
    border-top: 1px solid rgba(141, 150, 218, .18);
  }
  .law-field { padding: 8px 16px 32px; }
  .law-head { padding: 30px 20px 22px; }
  .law-head--dark { padding: 30px 0 20px; }
  .law-head__bar { border-left-width: 4px; padding-left: 18px; }
  .law-head__title { font-size: 30px; }
  .law-cm__map { padding: 20px; }
  .law-cm__map .law-map__controls { right: 30px; bottom: 30px; }
  .law-cm__legend { padding: 0 20px 24px; }
  .law-modal { padding: 16px; }
  .law-modal__head { padding: 20px 20px 10px; }
  .law-modal__head h3 { font-size: 22px; }
  .law-modal__body { padding: 6px 20px 20px; }
  .law-case { grid-template-columns: 1fr; }
  .law-case dt { border-right: none; padding-bottom: 4px; }
  .law-case dd { border-top: none; padding-top: 0; }
  .law-case dt:first-of-type + dd { padding-top: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .law-map__pin circle,
  .law-map__ctrl,
  .law-chip,
  .law-toggle__btn { transition: none; }
}
