/* =============================================================================
   PlacementFlow — Foundation School map explorer.

   Layers on top of styles/foundation-route.css and reuses its tokens rather
   than inventing a parallel system: the same --fd-* colours, the same radii,
   the same deliberately small type scale, the same focus ring.

   THE ONE NEW IDEA IN THE VISUAL LANGUAGE
   Three kinds of certainty get three kinds of line.
     - The coastline is real, so it is drawn crisp and hairline.
     - The divisions between schools are illustrative, so they are drawn soft
       and are never allowed a hard edge.
     - Locations are named by UKFPO but positioned approximately, so they are
       drawn as soft round tokens with no needle and no point.
   Nothing in this file may break that grammar.
   ============================================================================= */

:root, body.foundation-page {
  /* Motion. Restrained, in the same family as the shipped .2s ease-out drawer,
     tuned longer only where the distance travelled is genuinely larger. */
  --fdx-ease: cubic-bezier(.22, .68, .24, 1);
  --fdx-open: 320ms;
  --fdx-close: 240ms;
  --fdx-panel: 220ms;
  --fdx-fade: 180ms;

  /* Map surface, drawn from the shipped Explore the UK card's own family. */
  /* Land and sea have to separate at a glance, or the coastline stops doing
     the one job it has here: being the line the student can trust. */
  --fdx-sea-1: #d3e9f1;
  --fdx-sea-2: #c2dde8;
  --fdx-land: #fcfefd;
  --fdx-coast: #46808f;
  --fdx-graticule: rgba(70, 153, 180, .10);

  /* Three tints of one restrained family, so adjacent regions separate without
     the map becoming a colour chart. Assigned by graph colouring at runtime. */
  --fdx-tint-0: #7fc4a6;
  --fdx-tint-1: #9bd0c6;
  --fdx-tint-2: #b9dcae;
  --fdx-tint-3: #8fc9bd;
  --fdx-select: #0b8b58;
  --fdx-marker: #08694a;
  --fdx-marker-active: #d97a10;
}

/* =============================================================================
   1. THE COMPACT CARD — the existing Explore the UK card, and its way in.
   ============================================================================= */

/* The compact card keeps its shipped shell (.fd-map-card, sticky, from
   styles/foundation-route.css) and gains three things: the same illustrative
   coverage the explorer draws, a named way in, and the caveat that shading
   demands. The two views must agree about which lines are real. */
.fd-map-card { display: flex; flex-direction: column; }
body.foundation-page .fd-map-canvas { height: 322px; margin: -14px 8px 0; }
/* The shipped plot was sized for a 300x390 viewBox; the explorer frames the UK
   more tightly at 58 14 190 366, so the plot is re-proportioned to match its
   own SVG and fill the card without letterboxing the map inside its own box. */
body.foundation-page .fd-map-plot { width: auto; height: 100%; aspect-ratio: 190 / 366; margin: 0 auto; }
.fd-map-plot > svg { overflow: hidden; }

/* No sea on the small map. The card already has a ground of its own, and a
   painted sea rectangle inside a narrower plot reads as a blue box sitting on
   a mint card rather than as a coastline. */
.fd-map-coverage .fdx-cells { --fdx-strength: 62%; }
/* The Schools list's search and nation filters narrow the map too, so the two
   halves of the card never disagree about which schools are in play. */
.fd-map-coverage .fdx-cells[data-filtered="true"] { --fdx-strength: 12%; }
.fd-map-coast path {
  fill: none; stroke: var(--fdx-coast); stroke-width: 1.1;
  stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
}
.fd-map-land path { fill: var(--fdx-land); }

/* The entry affordance. Named, not just an icon, because a student has to know
   what it opens; sat over the canvas so it reads as belonging to the map. */
.fd-map-open-btn {
  position: absolute; z-index: 3; right: 12px; top: 12px;
  min-height: 34px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 11px 0 9px;
  border: 1px solid rgba(255, 255, 255, .95); border-radius: 999px;
  background: rgba(255, 255, 255, .93);
  color: var(--fd-green-deep); font-size: 10.5px; font-weight: 600;
  box-shadow: 0 8px 20px -14px rgba(18, 64, 73, .8);
  cursor: pointer;
  transition: background var(--fdx-fade) ease, box-shadow var(--fdx-fade) ease, transform var(--fdx-fade) ease;
}
.fd-map-open-btn .fd-icon { width: 14px; height: 14px; }
.fd-map-open-btn:hover { background: #fff; box-shadow: 0 10px 22px -12px rgba(18, 64, 73, .85); }
.fd-map-open-btn:active { transform: scale(.98); }

.fd-map-note {
  margin: 0 12px 10px; color: #54727c;
  font-size: 8.6px; font-weight: 600; line-height: 1.45;
}

/* =============================================================================
   2. THE FULL-SCREEN EXPLORER
   ============================================================================= */

.fdx-overlay {
  position: fixed; inset: 0; z-index: 1500;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--fdx-sea-2);
  opacity: 0;
  transition: opacity var(--fdx-open) var(--fdx-ease);
}
.fdx-overlay[data-state="open"] { opacity: 1; }
/* A dismissing overlay must not eat the click that dismissed it. Without
   this, a close followed immediately by a tap on Open map lands on the
   fading map instead of the button, and the reopen is silently lost. */
.fdx-overlay[data-state="closing"] { opacity: 0; pointer-events: none; transition-duration: var(--fdx-close); }
/* The open-state flag is deliberately NOT the open button's class. Naming both
   `fdx-open` was a real trap in review: querySelector('.fdx-open') then returned
   <html>, not the control. State lives on the root, the control is a button. */
html.fd-map-explorer-open, body.fd-map-explorer-open { overflow: hidden; }

/* --- retained chrome, enough to stay oriented ------------------------------ */
.fdx-topbar {
  position: relative; z-index: 6;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px calc(10px) 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(120, 168, 182, .28);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
}
.fdx-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.fdx-brand-mark {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--fd-blue); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
.fdx-brand-text { min-width: 0; }
.fdx-brand-text p { margin: 0; color: var(--fd-green-deep); font-size: 8.5px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; }
/* The title truncates rather than sliding under Close map: at 320px the two
   cannot both have their full width, and a half-hidden heading under a
   floating button reads as a broken layout. */
.fdx-brand-text h2 { margin: 1px 0 0; color: var(--fd-ink); font: 600 13.5px/1.2 var(--fd-display); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fdx-topbar-spacer { flex: 1 1 auto; }

.fdx-icon-button {
  min-width: 36px; min-height: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--fd-line); border-radius: 11px;
  background: #fff; color: var(--fd-slate);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: border-color var(--fdx-fade) ease, background var(--fdx-fade) ease, color var(--fdx-fade) ease;
}
.fdx-icon-button:hover { border-color: #bdd3ef; background: var(--fd-blue-soft); color: var(--fd-blue-deep); }
.fdx-icon-button .fd-icon { width: 15px; height: 15px; }

/* --- the map stage --------------------------------------------------------- */
.fdx-stage { position: relative; min-height: 0; overflow: hidden; cursor: grab; touch-action: none; }
.fdx-overlay { padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
.fdx-stage[data-panning="true"] { cursor: grabbing; }
.fdx-stage[data-panning="true"] .fdx-hit { cursor: grabbing; }
.fdx-map { display: block; width: 100%; height: 100%; }

/* The expansion. The stage starts matched to the compact card's plot rectangle
   and grows into place, so the explorer reads as the same map enlarging rather
   than an unrelated modal arriving. */
.fdx-stage-inner {
  position: absolute; inset: 0;
  transform-origin: 0 0;
  will-change: transform, opacity;
}
.fdx-overlay[data-anim="in"] .fdx-stage-inner,
.fdx-overlay[data-anim="out"] .fdx-stage-inner {
  transition: transform var(--fdx-open) var(--fdx-ease), opacity var(--fdx-open) var(--fdx-ease);
}
.fdx-overlay[data-anim="out"] .fdx-stage-inner { transition-duration: var(--fdx-close); }

/* --- map geometry ---------------------------------------------------------- */
.fdx-sea { fill: url(#fdx-sea-wash); }
.fdx-graticule { fill: none; stroke: var(--fdx-graticule); stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-width: 1.6; }
.fdx-landmass { fill: var(--fdx-land); }

/* The coastline: the one line on this map that is real. Crisp, hairline, and
   never blurred, so it can be told apart from everything illustrative. */
.fdx-coast path {
  fill: none; stroke: var(--fdx-coast); stroke-width: 1.3;
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* The illustrative divisions: soft by construction. --fdx-blur is kept in step
   with the camera so the softness stays visually constant at any zoom. */
.fdx-coverage { filter: url(#fdx-soften); }
.fdx-cells {
  --fdx-strength: 62%;
  opacity: 1;
  fill: color-mix(in srgb, var(--fdx-tint) var(--fdx-strength), var(--fdx-land));
  stroke: color-mix(in srgb, var(--fdx-tint) var(--fdx-strength), var(--fdx-land));
  transition: fill var(--fdx-fade) ease, stroke var(--fdx-fade) ease;
}
/* Opaque palette blends preserve the previous soft colours without translucent
   double-colouring at shared edges. A subpixel same-colour stroke closes raster
   antialias seams only; it does not alter fill, hit or minimap geometry. */
.fdx-cells path { fill: inherit; stroke: inherit; stroke-width: .6; vector-effect: non-scaling-stroke; }
.fdx-cells[data-tint="0"] { --fdx-tint: var(--fdx-tint-0); }
.fdx-cells[data-tint="1"] { --fdx-tint: var(--fdx-tint-1); }
.fdx-cells[data-tint="2"] { --fdx-tint: var(--fdx-tint-2); }
.fdx-cells[data-tint="3"] { --fdx-tint: var(--fdx-tint-3); }
.fdx-coverage[data-mode="national"] .fdx-cells[data-active="true"] { --fdx-strength: 92%; }
.fdx-coverage[data-mode="selected"] .fdx-cells { --fdx-strength: 30%; }
.fdx-coverage[data-mode="selected"] .fdx-cells[data-selected="true"] {
  fill: var(--fdx-select); stroke: var(--fdx-select);
}

/* Hit targets sit above the blurred artwork so pointer and focus behaviour is
   never at the mercy of a filter.

   pointer-events MUST be `all`, not the default. SVG's default is
   `visiblePainted`, and Chrome does not count a fully transparent fill as
   painted — so an invisible hit area is also an unclickable one, and the whole
   map silently stops responding to the mouse while still looking correct. */
.fdx-hit { fill: transparent; stroke: none; cursor: pointer; outline: none; }
.fdx-hit, .fdx-hit path { pointer-events: all; }
.fdx-hit .fdx-hit-ring { pointer-events: none; }
.fdx-hit:focus-visible .fdx-hit-ring { opacity: 1; }
.fdx-hit-ring {
  fill: none; stroke: #2b7fe5; stroke-width: 3; vector-effect: non-scaling-stroke;
  opacity: 0; pointer-events: none;
  transition: opacity var(--fdx-fade) ease;
}

/* --- labels ---------------------------------------------------------------- */
.fdx-labels text {
  fill: #17414a; font-family: var(--fd-display); font-weight: 600;
  font-size: 11px; letter-spacing: -.01em; text-anchor: middle; paint-order: stroke fill;
  stroke: rgba(255, 255, 255, .92); stroke-width: 3px; stroke-linejoin: round;
  pointer-events: none;
  transition: opacity var(--fdx-fade) ease, fill var(--fdx-fade) ease;
}
.fdx-labels g { opacity: 1; transition: opacity var(--fdx-fade) ease; }
.fdx-labels g[data-visible="false"] text { display: none; }
.fdx-labels g[data-visible="true"] .fdx-label-dot { display: none; }
.fdx-label-dot { fill: #2f6b74; opacity: .5; }
.fdx-labels g[data-active="true"] .fdx-label-dot { opacity: .9; }
.fdx-labels g[data-hidden="true"] { opacity: 0; }
.fdx-labels g[data-active="true"] text { fill: #0a3f31; }
.fdx-labels g[data-selected="true"] text { fill: #063d2a; }
/* The selected school's name becomes a title over its region. */
.fdx-labels g[data-title="true"] text {
  font-size: 15px;
  letter-spacing: -.02em;
  stroke-width: 4px;
}

/* --- location markers ------------------------------------------------------ */
/* Fixed local pixels; the group receives one inverse camera transform. */
/* Soft round tokens. Deliberately no needle, no point, no leader line: nothing
   in the shape may imply a surveyed position. */
.fdx-markers circle.fdx-dot {
  fill: #fff; stroke: var(--fdx-marker); stroke-width: 2; vector-effect: non-scaling-stroke;
}
.fdx-markers circle.fdx-halo { fill: var(--fdx-marker); opacity: .13; }
.fdx-markers g.fdx-marker {
  opacity: 0; cursor: pointer; outline: none;

}
.fdx-markers g.fdx-marker[data-shown="true"] {
  opacity: 1;
  transition: opacity 200ms var(--fdx-ease);
  transition-delay: var(--fdx-delay, 0ms);
}
/* Hover is resolved by proximity, not by the shape under the cursor, so the
   highlight is driven by data-near rather than :hover. */
.fdx-markers g.fdx-marker { pointer-events: none; }
.fdx-markers g.fdx-marker[data-near="true"] circle.fdx-dot,
.fdx-markers g.fdx-marker:focus-visible circle.fdx-dot { stroke: var(--fdx-marker-active); }
.fdx-markers g.fdx-marker[data-near="true"] circle.fdx-halo,
.fdx-markers g.fdx-marker:focus-visible circle.fdx-halo { fill: var(--fdx-marker-active); opacity: .22; }
/* The one name the official list cannot disambiguate is drawn open, and
   carries a dagger to its footnote, rather than being silently resolved. */
.fdx-markers g.fdx-marker[data-ambiguous="true"] circle.fdx-dot { stroke-dasharray: 3 2.5; }
.fdx-markers g.fdx-marker[data-open="true"] circle.fdx-dot { fill: var(--fdx-marker-active); stroke: var(--fdx-marker-active); }
.fdx-markers g.fdx-marker[data-open="true"] circle.fdx-halo { fill: var(--fdx-marker-active); opacity: .26; }
.fdx-markers text {
  fill: #17414a; font-family: var(--fd-display); font-weight: 600;
  paint-order: stroke fill; stroke: rgba(255, 255, 255, .95);
  stroke-width: 2.6px;
  font-size: 12px; letter-spacing: 0;
  stroke-linejoin: round; pointer-events: none;
}
/* A name suppressed by crowding is not a name lost: it comes back the moment
   the marker is pointed at or focused, and it is always in the panel list. */
.fdx-markers g.fdx-marker[data-labelled="false"] text { display: none; }
.fdx-markers g.fdx-marker[data-labelled="false"][data-near="true"] text,
.fdx-markers g.fdx-marker[data-labelled="false"]:focus-visible text,
.fdx-markers g.fdx-marker[data-labelled="false"][data-open="true"] text { display: block; }
.fdx-markers g.fdx-marker[data-near="true"] text,
.fdx-markers g.fdx-marker:focus-visible text { font-weight: 700; }

/* Placement uses measured text bounds in fixed local pixels. */
.fdx-marker-focus {
  fill: none; stroke: #2b7fe5; stroke-width: 3; vector-effect: non-scaling-stroke;
  opacity: 0; pointer-events: none;
}
.fdx-markers g.fdx-marker:focus-visible .fdx-marker-focus { opacity: 1; }

/* =============================================================================
   3. FLOATING CONTROLS
   ============================================================================= */

.fdx-layer { position: absolute; inset: 0; pointer-events: none; }
.fdx-layer > * { pointer-events: auto; }

/* --- school selector (the non-hover, non-precision way in) ----------------- */
/* Once a school is chosen the finder steps back to a single row, handing the
   map the width it was using. It stays a full combobox the moment it is
   touched or focused, so nothing is lost. */
.fdx-finder[data-collapsed="true"] { width: 250px; }
.fdx-finder[data-collapsed="true"] .fdx-finder-list { display: none; }
.fdx-finder {
  position: absolute; left: 16px; top: 16px; width: 268px;
  transition: width var(--fdx-panel) var(--fdx-ease);
  border: 1px solid var(--fd-line); border-radius: 15px;
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.fdx-finder-field { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 11px; }
.fdx-finder-field .fd-icon { width: 15px; height: 15px; flex: none; color: var(--fd-muted); }
.fdx-finder-field input {
  min-width: 0; flex: 1 1 auto; min-height: 26px;
  border: 0; background: transparent; color: var(--fd-ink);
  font-size: 12px; font-weight: 500; outline: none;
}
.fdx-finder-field input::placeholder { color: var(--fd-muted); font-weight: 500; }
.fdx-finder-count { flex: none; color: var(--fd-green-deep); font: 600 9.5px/1 var(--fd-display); }
.fdx-finder-list {
  max-height: min(46vh, 340px); overflow: auto; overscroll-behavior: contain;
  margin: 0; padding: 0 6px 6px; list-style: none;
  border-top: 1px solid var(--fd-line);
}
.fdx-finder-list li { margin: 0; }
.fdx-finder-option {
  width: 100%; min-height: 42px; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 7px 9px; margin-top: 4px;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--fd-ink);
  text-align: left; cursor: pointer;
  transition: background var(--fdx-fade) ease, border-color var(--fdx-fade) ease;
}
.fdx-finder-option:hover, .fdx-finder-option[data-cursor="true"] { border-color: #cfe3f8; background: var(--fd-blue-soft); }
.fdx-finder-option[aria-selected="true"] { border-color: #b7e2cc; background: var(--fd-green-soft); }
.fdx-finder-option b { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.fdx-finder-option small { display: block; margin-top: 2px; color: var(--fd-slate); font-size: 9px; line-height: 1.3; }
.fdx-finder-option .fdx-swatch { width: 9px; height: 9px; flex: none; border-radius: 3px; }
.fdx-finder-empty { padding: 14px 10px; color: var(--fd-slate); font-size: 10.5px; text-align: center; }

/* --- locator inset --------------------------------------------------------- */
/* Sits directly under the collapsed finder: both controls answer "where am I",
   and it keeps the bottom-left free for the coverage caveat and the location
   card, which must never cover each other. */
.fdx-locator {
  position: absolute; left: 16px; top: 72px; width: 108px;
  padding: 8px 8px 6px;
  border: 1px solid var(--fd-line); border-radius: 13px;
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--fd-shadow);
  backdrop-filter: blur(12px);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity var(--fdx-panel) var(--fdx-ease), transform var(--fdx-panel) var(--fdx-ease);
}
.fdx-locator[data-shown="true"] { opacity: 1; transform: none; }
.fdx-locator svg { display: block; width: 100%; height: 132px; }
.fdx-locator > span {
  display: block; margin-top: 4px;
  color: var(--fd-slate); font-size: 8px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; text-align: center;
}
.fdx-loc-land path { fill: #eef4f5; }
.fdx-loc-coast path { fill: none; stroke: #9dbcc6; stroke-width: .9; vector-effect: non-scaling-stroke; }
.fdx-loc-cells path { fill: #cfe3d8; stroke: none; }
.fdx-loc-cells[data-selected="true"] path { fill: var(--fdx-select); }
.fdx-loc-view {
  fill: rgba(31, 111, 214, .1);
  stroke: var(--fd-blue); stroke-width: 1.4; vector-effect: non-scaling-stroke;
}

/* --- coverage honesty note ------------------------------------------------- */
.fdx-legend {
  position: absolute; left: 16px; bottom: 16px; max-width: 268px;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px;
  border: 1px solid #ecd39f; border-radius: 11px;
  background: rgba(255, 249, 237, .95);
  box-shadow: 0 10px 26px -20px rgba(18, 33, 62, .8);
  backdrop-filter: blur(10px);
  color: #754a13; font-size: 9.5px; font-weight: 600; line-height: 1.45;
}
.fdx-legend-more {
  flex: none; min-width: 22px; min-height: 22px; display: grid; place-items: center;
  border: 1px solid #e0cb9c; border-radius: 999px; background: #fff;
  color: #8a5c16; cursor: pointer;
}
.fdx-legend-more .fd-icon { width: 13px; height: 13px; }

/* --- reset to the national view -------------------------------------------- */
.fdx-reset {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  min-height: 38px; display: inline-flex; align-items: center; gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--fd-line); border-radius: 999px;
  background: rgba(255, 255, 255, .96); color: var(--fd-blue-deep);
  font-size: 11px; font-weight: 600; cursor: pointer;
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--fdx-panel) var(--fdx-ease), transform var(--fdx-panel) var(--fdx-ease);
}
.fdx-reset[data-shown="true"] { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.fdx-reset[data-shown="false"] { transform: translateX(-50%) translateY(6px); }
.fdx-reset .fd-icon { width: 14px; height: 14px; }

.fdx-recentre {
  position: absolute; right: 362px; bottom: 18px;
  min-height: 34px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 13px;
  border: 1px solid #ecd39f; border-radius: 999px;
  background: rgba(255, 249, 237, .97); color: #754a13;
  font-size: 10px; font-weight: 600; cursor: pointer;
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity var(--fdx-panel) var(--fdx-ease), transform var(--fdx-panel) var(--fdx-ease);
}
.fdx-recentre[data-shown="true"] { opacity: 1; pointer-events: auto; transform: none; }
.fdx-recentre .fd-icon { width: 13px; height: 13px; }
@media (max-width: 820px) { .fdx-recentre { right: 10px; bottom: auto; top: 106px; } }

/* =============================================================================
   4. THE SCHOOL PANEL (desktop)
   ============================================================================= */

.fdx-panel {
  position: absolute; right: 16px; top: 16px; bottom: 16px; width: 330px;
  display: flex; flex-direction: column;
  border: 1px solid var(--fd-line); border-radius: 17px;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(16px);
  opacity: 0; transform: translateX(10px);
  pointer-events: none;
  transition: opacity var(--fdx-panel) var(--fdx-ease), transform var(--fdx-panel) var(--fdx-ease);
}
.fdx-panel[data-shown="true"] { opacity: 1; transform: none; pointer-events: auto; }
.fdx-panel-head { padding: 15px 16px 12px; border-bottom: 1px solid var(--fd-line); }
.fdx-panel-head .fd-label { margin-bottom: 7px; }
.fdx-panel-head h3 { margin: 0; color: var(--fd-ink); font: 600 17px/1.18 var(--fd-display); letter-spacing: -.03em; overflow-wrap: anywhere; }
.fdx-panel-geo { margin: 7px 0 0; color: var(--fd-slate); font-size: 10.5px; line-height: 1.5; }
.fdx-panel-body { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 13px 16px; }
.fdx-panel-foot { padding: 11px 16px calc(13px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--fd-line); display: grid; gap: 7px; grid-template-columns: minmax(0, 1fr) auto auto; }
.fdx-panel-foot .fd-btn { width: 100%; }
.fdx-panel-quiet { min-width: 42px; min-height: 44px; display: grid; place-items: center; border: 1px solid var(--fd-line); border-radius: 11px; background: #fff; color: var(--fd-slate); cursor: pointer; }
.fdx-panel-quiet[aria-pressed="true"] { border-color: #b7e2cc; background: var(--fd-green-soft); color: var(--fd-green-deep); }

/* The spread. The map can show the shape of a catchment; only a number can
   say how far across it actually is, and that is the question being asked. */
.fdx-spread {
  margin: 0 0 9px; padding: 11px 12px;
  border: 1px solid #b7e2cc; border-radius: 13px;
  background: linear-gradient(160deg, #f0fbf5, var(--fd-green-soft));
}
.fdx-spread strong {
  display: block; color: var(--fd-green-deep);
  font: 600 24px/1 var(--fd-display); letter-spacing: -.035em;
}
.fdx-spread span { display: block; margin-top: 4px; color: #2a5f49; font-size: 10.5px; font-weight: 600; line-height: 1.4; }
.fdx-spread small { display: block; margin-top: 6px; color: #4d7a66; font-size: 8.8px; line-height: 1.45; }

.fdx-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0 0 12px; }
.fdx-stat { padding: 9px 10px; border: 1px solid var(--fd-line); border-radius: 11px; background: var(--fd-ground); }
.fdx-stat strong { display: block; color: var(--fd-ink); font: 600 16px/1.1 var(--fd-display); letter-spacing: -.02em; }
.fdx-stat span { display: block; margin-top: 3px; color: var(--fd-slate); font-size: 8.6px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.fdx-stat--wide { grid-column: 1 / -1; }

.fdx-block { margin: 0 0 13px; }
.fdx-block h4 { margin: 0 0 6px; color: var(--fd-ink); font: 600 11.5px/1.3 var(--fd-display); }
.fdx-block p { margin: 0 0 6px; color: #43516a; font-size: 10.2px; line-height: 1.55; }
.fdx-note { margin: 0; color: var(--fd-slate); font-size: 9.2px; line-height: 1.45; }
/* The scale promise. Grey, because it is how the tool works rather than a
   number that could mislead — the amber family is reserved for the latter. */
.fdx-scale-note {
  margin: 0 0 6px; padding: 7px 9px;
  border-left: 2px solid #b7e2cc; border-radius: 0 8px 8px 0;
  background: var(--fd-green-soft); color: var(--fd-green-deep);
  font-size: 9.4px; font-weight: 600; line-height: 1.45;
}
.fdx-warn {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 9px 10px;
  border: 1px solid #ecd39f; border-radius: 11px; background: #fff9ed;
  color: #754a13; font-size: 9.4px; font-weight: 600; line-height: 1.45;
}

.fdx-locations { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; padding: 0; list-style: none; }
.fdx-location {
  min-height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px;
  border: 1px solid var(--fd-line); border-radius: 999px; background: #fff;
  color: var(--fd-ink); font-size: 10px; font-weight: 500; cursor: pointer;
  transition: border-color var(--fdx-fade) ease, background var(--fdx-fade) ease;
}
.fdx-location:hover, .fdx-location[aria-pressed="true"] { border-color: #cbe6d8; background: var(--fd-green-soft); color: var(--fd-green-deep); }
.fdx-location i { width: 5px; height: 5px; flex: none; border-radius: 999px; background: var(--fdx-marker); font-style: normal; }

/* =============================================================================
   5. THE LOCATION SURFACE
   ============================================================================= */

.fdx-place {
  display: flex; flex-direction: column; max-height: calc(100dvh - 170px);
  position: absolute; left: 16px; bottom: 66px; width: 268px;
  border: 1px solid var(--fd-line); border-radius: 15px;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity var(--fdx-panel) var(--fdx-ease), transform var(--fdx-panel) var(--fdx-ease);
}
.fdx-place[data-shown="true"] { opacity: 1; transform: none; pointer-events: auto; }
.fdx-place-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 12px 9px; }
.fdx-place-head h4 { margin: 3px 0 0; color: var(--fd-ink); font: 600 14px/1.2 var(--fd-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.fdx-place-head p { margin: 0; color: var(--fd-green-deep); font-size: 8.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.fdx-place-close { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--fd-line); border-radius: 9px; background: #fff; color: var(--fd-slate); cursor: pointer; }
.fdx-place-close .fd-icon { width: 13px; height: 13px; }
.fdx-place-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 12px 12px; }
.fdx-place-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--fd-line); }
.fdx-place-row dt { flex: none; width: 84px; color: var(--fd-slate); font-size: 8.8px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.fdx-place-row dd { margin: 0; min-width: 0; color: var(--fd-ink); font-size: 10.4px; line-height: 1.45; }

/* =============================================================================
   6. PROVENANCE POPOVER — the honest answer to "where did this shape come from"
   ============================================================================= */

.fdx-provenance {
  position: absolute; left: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px));
  max-height: min(70vh, 520px); overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--fd-line); border-radius: 15px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(16px);
  padding: 14px 15px calc(15px + env(safe-area-inset-bottom, 0px));
}
.fdx-provenance[hidden] { display: none !important; }
.fdx-provenance h4 { margin: 0 0 3px; color: var(--fd-ink); font: 600 13px/1.25 var(--fd-display); }
.fdx-provenance p { margin: 0 0 9px; color: #43516a; font-size: 10px; line-height: 1.55; }
.fdx-provenance dt { color: var(--fd-slate); font-size: 8.6px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.fdx-provenance dd { margin: 2px 0 8px; color: var(--fd-ink); font-size: 10px; line-height: 1.5; }
.fdx-provenance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }

.fdx-handoff {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  padding: 13px 15px 15px;
  border: 1px solid var(--fd-line); border-radius: 15px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--fd-shadow-lift);
  backdrop-filter: blur(16px);
}
.fdx-handoff[hidden] { display: none !important; }
.fdx-handoff h4 { margin: 0; color: var(--fd-ink); font: 600 13px/1.25 var(--fd-display); }
.fdx-handoff p { margin: 0; color: #43516a; font-size: 10px; line-height: 1.55; }
.fdx-handoff b { color: var(--fd-ink); font-weight: 600; }

/* =============================================================================
   7. MOBILE — a different design, not a smaller one.
   ============================================================================= */

@media (max-width: 820px) {
  /* One control row, not a stack of floating cards. The map is the screen, so
     everything else is either a single row at the top or the sheet at the
     bottom, and the camera is told about both. */
  .fdx-controls {
    position: absolute; left: 10px; right: 10px; top: 10px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
    align-items: start;
  }
  .fdx-finder {
    position: static; width: auto; border-radius: 13px;
    max-height: calc(100dvh - 220px); overflow: hidden;
  }
  .fdx-finder[data-collapsed="true"] { width: auto; }
  .fdx-finder-list { max-height: min(38dvh, 300px); }

  .fdx-reset {
    position: static; transform: none; min-height: 44px; min-width: 44px;
    padding: 0 12px; border-radius: 13px;
  }
  .fdx-reset[data-shown="false"] { transform: none; }
  .fdx-reset[data-shown="true"] { transform: none; }
  .fdx-reset span { display: none; }

  .fdx-legend {
    left: 10px; right: 10px; bottom: auto; top: 64px; max-width: none;
    padding: 7px 9px; font-size: 9px;
    transition: opacity var(--fdx-fade) ease;
  }
  /* At the full detent the sheet carries the same caveat in its coverage
     block, so the floating one steps out rather than showing through. And an
     open school list owns the top of the screen while it is open. */
  body.fd-map-sheet-full .fdx-legend,
  body.fd-map-finder-open .fdx-legend { opacity: 0; pointer-events: none; }
  body.fd-map-finder-open .fdx-locator { opacity: 0; }
  .fdx-locator { display: none; }
  .fdx-panel { display: none; }
  .fdx-place { z-index: 9; left: 10px; right: 10px; width: auto; bottom: auto; top: 106px; }
  .fdx-provenance { left: 10px; right: 10px; bottom: auto; top: 64px; width: auto; }
  .fdx-handoff { left: 10px; right: 10px; transform: none; width: auto; bottom: auto; top: 106px; }

  /* The sheet. Three detents, and the map keeps working at the first two. */
  .fdx-sheet {
    position: absolute; z-index: 8; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column;
    height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--fd-line);
    background: #fff;
    box-shadow: 0 -18px 44px -30px rgba(7, 18, 38, .8);
    transform: translateY(100%);
    transition: transform var(--fdx-panel) var(--fdx-ease);
    touch-action: none;
  }
  .fdx-sheet[data-detent="peek"] { transform: translateY(calc(100% - var(--fdx-peek, 210px))); }
  .fdx-sheet[data-detent="half"] { transform: translateY(calc(100% - var(--fdx-half, 52dvh))); }
  .fdx-sheet[data-detent="full"] { transform: translateY(8dvh); }
  .fdx-sheet[data-dragging="true"] { transition: none; }
  .fdx-sheet-grab { flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: #d9dfe8; }
  .fdx-sheet-handle {
    flex: none; width: 100%; display: block; min-height: 28px; padding: 0 0 4px;
    border: 0; background: transparent; cursor: grab;
  }
  /* The action row sits directly under the title rather than at the foot of a
     92dvh sheet, so the one thing a student came to do is reachable at the
     peek detent without dragging anything. */
  .fdx-sheet-handle { order: 0; }
  .fdx-sheet-head { order: 1; flex: none; padding: 4px 16px 11px; text-align: left; }
  .fdx-sheet-foot { order: 2; }
  .fdx-sheet-body { order: 3; }
  .fdx-sheet-head { flex: none; padding: 4px 16px 11px; text-align: left; }
  .fdx-sheet-head .fd-label { margin-bottom: 6px; }
  .fdx-sheet-head h3 { margin: 0; color: var(--fd-ink); font: 600 16px/1.2 var(--fd-display); letter-spacing: -.03em; }
  .fdx-sheet-summary { margin: 5px 0 0; color: var(--fd-slate); font-size: 10.5px; line-height: 1.5; }
  .fdx-sheet-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
  .fdx-sheet-body { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 2px 16px 12px; }
  .fdx-sheet[data-detent="peek"] .fdx-sheet-body { overflow: hidden; }
  .fdx-sheet-foot {
    flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px;
    padding: 2px 16px 12px;
    background: #fff;
  }
  .fdx-sheet-body { border-top: 1px solid var(--fd-line); padding-top: 11px; }
  .fdx-sheet-foot .fd-btn { width: 100%; }

  .fdx-topbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .fdx-brand { flex: 0 1 auto; }
  .fdx-brand-text h2 { font-size: 12px; }
  .fdx-brand-text p { display: none; }
}

@media (min-width: 821px) { .fdx-sheet { display: none; } }

@media (max-width: 520px) {
  .fdx-brand-text p { display: none; }
  .fdx-panel-foot, .fdx-sheet-foot { grid-template-columns: minmax(0, 1fr) auto auto; }
}

/* =============================================================================
   8. REDUCED MOTION
   Every state must still be fully expressed — only the travel between states is
   removed. The camera cuts instead of flying, markers arrive together instead of
   in sequence, and nothing is left mid-transition.
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  :root, body.foundation-page {
    --fdx-open: 1ms; --fdx-close: 1ms; --fdx-frame: 1ms; --fdx-switch: 1ms;
    --fdx-reset: 1ms; --fdx-panel: 1ms; --fdx-fade: 1ms;
  }
  .fdx-overlay, .fdx-stage-inner, .fdx-panel, .fdx-place, .fdx-reset, .fdx-sheet,
  .fdx-markers g.fdx-marker, .fdx-cells, .fdx-labels g {
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
  .fdx-stage-inner { transition: none !important; }
  .fd-map-coverage .fdx-cells, .fd-map-open-btn { transition: none !important; }
}

/* =============================================================================
   9. THE COMPACT CARD ON A PHONE
   The shipped card at <=768px is a fixed 270px box with the plot pinned to its
   right. The coverage card carries more below the map — a caveat and a footer
   control — so it lays out as a column and lets its own content set the height.
   ============================================================================= */

/* Below 800px the Schools layout is one column, so the card would stretch to
   the full content width while the map inside it stays portrait — a small
   outline adrift in a wide banner. Cap and centre it so it still reads as a
   map. Below 430px this is a no-op and the card is full width as before. */
@media (max-width: 800px) {
  body.foundation-page .fd-map-card { max-width: 430px; margin-inline: auto; }
}

@media (max-width: 768px) {
  body.foundation-page .fd-map-card { position: relative; height: auto; margin-bottom: 10px; }
  body.foundation-page .fd-map-canvas {
    position: relative; right: auto; top: auto;
    width: auto; height: 232px; margin: -10px 8px 0;
  }
  body.foundation-page .fd-map-copy { position: relative; left: auto; top: auto; width: auto; padding: 14px 15px 0; }
  body.foundation-page .fd-map-plot { width: auto; height: 100%; }
  body.foundation-page .fd-map-selected { position: relative; left: auto; bottom: auto; width: calc(100% - 24px); margin: 0 12px 12px; }
  .fd-map-open-btn { right: 10px; top: 10px; min-height: 40px; }
}

@media (max-width: 380px) {
  body.foundation-page .fd-map-canvas { height: 208px; }
  .fdx-brand-mark { width: 22px; height: 22px; font-size: 9px; }
  .fdx-brand-text h2 { font-size: 11.5px; }
  .fdx-icon-button { padding: 0 9px; font-size: 10.5px; }
}

/* Preserve interior rings in the coast, coverage and identical hit geometry. */
.fdx-map path, .fdx-locator path, .fd-map-plot path { fill-rule: evenodd; clip-rule: evenodd; }
