/* ==========================================================================
 * Setup My Topo Custom Map — page styles
 * Mirrors Figma node 3873:59840 using Modus 2.0 tokens (light mode).
 * ========================================================================== */

/* The shared base.html always renders a `.site-header` for the home page
 * breadcrumb.  This page has its own `.cfg-topbar`, so hide the default
 * one rather than refactor base.html. */
body.configure-page > .site-header {
  display: none;
}

/* On desktop the page is locked to the viewport: the top bar is fixed
 * height, the map (right column) is fixed to the remaining viewport,
 * and only `.cfg-left` scrolls internally.  The browser's scroll wheel
 * is therefore free to act as Mapbox's zoom when the cursor is over
 * the map.  Mobile/tablet (<1240px) reverts to normal page scroll
 * since columns stack vertically. */
body.configure-page {
  background: #ffffff;
  color: #171c1e;
  /* Fill the *visible* viewport.  CSS viewport units all misbehave on iOS
   * (they count the browser's top/bottom chrome as usable space — worst in
   * Chrome iOS), which pushed the bottom-anchored controls behind the toolbar
   * and left the panel's "Add to Cart" unreachable.  So the authoritative
   * value is `--app-height`, set by configure_map.js from
   * `window.innerHeight` (the actually-visible height on iOS, kept fresh on
   * resize / orientation change).  The 100vh → 100svh declarations below it
   * are pre-JS fallbacks: 100svh (the smallest viewport, chrome shown) is the
   * closest static approximation, 100vh the ancient-browser floor. */
  height: 100vh;
  height: 100svh;
  height: var(--app-height, 100svh);
  /* base.css sets `body { min-height: 100vh }`.  `100vh` is the LARGE viewport
   * (as if the browser's dynamic toolbars were retracted), which on mobile is
   * TALLER than the actually-visible area — and because min-height beats
   * height when it's larger, that base rule silently forced the shell taller
   * than the screen no matter what `--app-height`/`100svh` resolved to.  The
   * extra strip then overflowed behind the browser chrome and the whole
   * document became scrollable at the viewport level, so you could see the top
   * bar OR the bottom controls but never both.  Cancel that inherited floor so
   * the `height` above (the visible viewport) actually governs. */
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  /* Height of the floating frosted top bar (10px padding × 2 + 40px content
   * + 1px border).  The map fills the full viewport *behind* the bar so its
   * frosted glass shows the map through it; every top-anchored overlay below
   * is shifted down by this amount so nothing hides under the bar. */
  --cfg-topbar-h: 61px;
}

body.configure-page main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * 1. Top bar — mytopo logo + breadcrumb + Shopping Cart button
 * ------------------------------------------------------------------------- */
.cfg-topbar {
  /* Float over the map (top edge, full width) so the map paints behind it
     and the frosted glass reveals the map underneath. */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--cfg-topbar-h);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 30px;
  /* Same frosted-glass surface as the home page header (and the options
     panel) — translucent white + blur, hairline border, soft drop shadow
     that floats the bar above the map below. */
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.18);
}

.cfg-topbar__left {
  display: flex;
  align-items: center;
  gap: 60px;
}

.cfg-topbar__logo {
  display: flex;
  width: 73px;
  height: 40px;
  text-decoration: none;
}

.cfg-topbar__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Draft-order cart badge (top-right). Hidden unless the cart flow is on. */
.cfg-topbar__right {
  display: flex;
  align-items: center;
}

.cfg-cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cfg-cart-link:hover {
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

/* Help ("?") button + its one-item menu (launches the edit-mode tour). */
.cfg-help {
  position: relative;
}

.cfg-topbar__help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  margin-right: 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cfg-topbar__help:hover,
.cfg-topbar__help[aria-expanded="true"] {
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.cfg-help-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  margin: 0;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  list-style: none;
  z-index: 40;
}

.cfg-help-menu[hidden] {
  display: none;
}

.cfg-help-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #171c1e;
  font-family: var(--mt-font-primary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.cfg-help-menu__item:hover,
.cfg-help-menu__item:focus-visible {
  background: rgba(15, 23, 42, 0.06);
  outline: none;
}

.cfg-help-menu__item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #0063a3;
}

/* "Tour - Move the print area" below the ~800px breakpoint where Share/Cart's own
 * labels collapse to icon-only (see the `@media (max-width: 800px)` rule
 * in section 5) — the tour's spotlight steps target those labels/expanded
 * controls by name, so it disables itself rather than hiding (staying
 * visible communicates it's coming back once the window's wide enough,
 * rather than looking like the feature vanished). Toggled via
 * `[disabled]` + `aria-disabled` by `_updateTourAvailability` in
 * configure_map.js section 19, not a hidden `<li>` like the "Driver.js
 * failed to load" case just above it. */
.cfg-help-menu__item[disabled] {
  cursor: not-allowed;
  color: #8a8f93;
  opacity: 0.6;
}

.cfg-help-menu__item[disabled]:hover,
.cfg-help-menu__item[disabled]:focus-visible {
  background: transparent;
}

.cfg-help-menu__item[disabled] svg {
  color: #8a8f93;
}

.cfg-topbar__share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 14px;
  margin-right: 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: #0f172a;
  /* `<button>`s don't inherit the page's font-family from the UA
   * stylesheet the way `.cfg-cart-link` (a plain `<a>`) does — without
   * this, "Share" rendered in the browser's default UI font instead of
   * `--mt-font-primary`, which at the same declared `font-weight: 600`
   * ends up looking visibly bolder/heavier than the "Cart" link right next
   * to it. */
  font-family: var(--mt-font-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cfg-topbar__share:hover {
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

/* Same glyph footprint so Share + Cart pills stay the same height. */
.cfg-topbar__share svg,
.cfg-cart-link > svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

/* Red count badge — same corner-pill treatment as `.home-cart__badge`
 * (home.css): hugs the top-right of the cart control, circle for 1 digit
 * / pill for 2+. Always visible on configure (including 0); home hides
 * its badge when empty. */
.cfg-cart-link__count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: #e11d48;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.45);
  pointer-events: none;
}

.cfg-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #171c1e;
}

.cfg-breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  color: #171c1e;
  text-decoration: none;
  line-height: 24px;
  transition: background-color 120ms ease;
}

.cfg-breadcrumbs__item:hover,
.cfg-breadcrumbs__item:focus-visible {
  background-color: rgba(0, 0, 0, 0.05);
  outline: none;
}

.cfg-breadcrumbs__item--current {
  color: #171c1e;
  cursor: default;
}

.cfg-breadcrumbs__item--current:hover {
  background: transparent;
}

.cfg-breadcrumbs__sep {
  color: #6a6e79;
  font-size: 14px;
  user-select: none;
}

.cfg-breadcrumbs__home {
  color: #171c1e;
}

.cfg-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #f1f1f6;
  color: #171c1e;
  font-family: var(--mt-font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 28px;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.cfg-cart-btn:hover,
.cfg-cart-btn:focus-visible {
  background-color: #e6e7ee;
  outline: none;
}

.cfg-cart-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(12, 119, 190, 0.4);
}

/* ---------------------------------------------------------------------------
 * 2. Page layout — full-bleed map with a floating, collapsible options panel
 *
 *    The map (`.cfg-preview`) is the base layer: it fills the entire area
 *    below the top bar edge-to-edge.  The customise options live in a
 *    frosted-glass panel (`.cfg-panel`) that floats over the LEFT edge of
 *    the map and can be collapsed out of the way.  Because both are
 *    absolutely positioned inside `.cfg-layout`, DOM order is irrelevant —
 *    z-index keeps the panel above the map.
 *
 *    `--cfg-map-offset` is the horizontal inset (in px) that JS keeps in
 *    sync with the expanded panel's rendered width.  The Mapbox camera is
 *    given a matching `padding.left`, and the CSS-centered overlays (info
 *    card, Preview CTA, WMS image/grid/frame) are shifted by this amount so
 *    the map's geographic centre stays parked in the RIGHT region of the
 *    screen — exactly where it sat in the old split layout.
 * ------------------------------------------------------------------------- */
.cfg-layout {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  width: 100%;
  --cfg-map-offset: 0px;
}

/* ---- Frosted, collapsible options panel --------------------------------- */
.cfg-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  width: min(924px, 60%);
  display: flex;
  flex-direction: column;
  /* Panel spans the full viewport height (behind the floating top bar); pad
   * the top so its scrolling content starts just below the bar. */
  padding-top: var(--cfg-topbar-h);
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 4px 0 32px rgba(15, 23, 42, 0.18);
  transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  /* Shared element for the cross-document morph from the home page's
     search box (see base.css → `@view-transition`).  Confirming a
     search makes that box fly left and grow into this panel. */
  view-transition-name: vt-panel;
}

/* Collapsed — slide the whole panel (and its in-panel toggle) off the left
 * edge.  The floating `.cfg-panel-launcher` reappears to bring it back. */
.cfg-panel[data-collapsed="true"] {
  transform: translateX(-100%);
}

/* Internal scroll lives on the wrapper, not `.cfg-left`, so the toggle tab
 * can stay pinned while the form scrolls. */
.cfg-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* Neat frosted-glass scrollbar (Firefox) — slim, translucent-white
   * thumb on a transparent track instead of the default dark bar. */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.75) transparent;
}

/* WebKit/Blink (Chrome, Safari, Edge) — match the frosted panel: a
 * rounded translucent-white thumb floated on a transparent track, with
 * a hairline inner outline so the white pill stays visible over the
 * light glass.  The transparent border + padding-box clip insets the
 * thumb so it reads as a slim floating pill rather than a full-width bar. */
.cfg-panel__scroll::-webkit-scrollbar {
  width: 10px;
}

.cfg-panel__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.cfg-panel__scroll::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.7);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.cfg-panel__scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.92);
}

/* Collapse tab — pinned to the panel's outer (right) edge so it reads as a
 * handle on the frosted sheet. */
.cfg-panel__toggle {
  position: absolute;
  top: calc(14px + var(--cfg-topbar-h));
  right: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  /* Match the in-panel items (accordion headers): a flat translucent-white
     surface with a hairline border and a soft drop + inner-top highlight. */
  border: 1px solid rgba(23, 28, 30, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  color: #171c1e;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background-color 140ms ease;
}

.cfg-panel__toggle:hover {
  background: rgba(255, 255, 255, 0.8);
}

.cfg-panel__toggle:focus-visible {
  outline: 2px solid rgba(12, 119, 190, 0.7);
  outline-offset: 2px;
}

/* Floating launcher — opaque pill over the map, shown only while collapsed. */
.cfg-panel-launcher {
  position: absolute;
  top: calc(16px + var(--cfg-topbar-h));
  left: 16px;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #171c1e;
  font-family: var(--mt-font-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.cfg-panel-launcher:hover,
.cfg-panel-launcher:focus-visible {
  background-color: #f1f1f6;
  outline: none;
}

.cfg-panel-launcher[hidden] {
  display: none;
}

.cfg-left {
  padding: 10px 20px 20px;
}

.cfg-title {
  margin: 0 0 8px;
  font-family: var(--mt-font-primary);
  font-size: 17px;
  font-weight: 700;
  line-height: 24px;
  color: #353a40;
}

/* ---------------------------------------------------------------------------
 * 2b. Accordion — two independently collapsible sections (Stock Maps +
 *     Custom Map) stacked inside the one frosted panel.  Distinct from
 *     `.cfg-panel__toggle`, which slides the WHOLE sheet off the left edge.
 *     Each header is a full-width glassy bar; its chevron flips 180° when the
 *     section is open, and the body is shown/hidden via the `hidden` attribute
 *     toggled in `configure_map.js` (section 13c).
 * ------------------------------------------------------------------------- */
.cfg-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Reserve a right gutter on the header bars so their right edge (and chevron)
 * clears the whole-panel collapse toggle pinned at top:14px/right:14px (34px
 * wide ⇒ ~48px of panel-edge footprint).  Applied to both bars so they stay
 * the same length; the bodies/form below keep full width. */
.cfg-accordion__heading {
  margin: 0 44px 0 0;
}

.cfg-accordion__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(23, 28, 30, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-family: var(--mt-font-primary);
  text-align: left;
  transition: background-color 140ms ease;
}

.cfg-accordion__header:hover {
  background: rgba(255, 255, 255, 0.8);
}

.cfg-accordion__header:focus-visible {
  outline: 2px solid rgba(12, 119, 190, 0.7);
  outline-offset: 2px;
}

.cfg-accordion__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
  color: #353a40;
}

.cfg-accordion__chevron {
  flex-shrink: 0;
  color: #353a40;
  transition: transform 200ms ease;
}

/* Open section: flip the chevron to point up. */
.cfg-accordion__item[data-expanded="true"] .cfg-accordion__chevron {
  transform: rotate(180deg);
}

.cfg-accordion__body {
  padding: 0 2px;
}

.cfg-accordion__body[hidden] {
  display: none;
}

/* ---- Stock-map list ----------------------------------------------------- */
.cfg-stock__intro {
  margin: 8px 2px 12px;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  line-height: 16px;
  /* Dark slate (was #6a6e79) so it stays legible when the translucent
   * panel floats over dark satellite / hybrid imagery. */
  color: #2f343a;
}

/* Horizontal strip: cards lay out in a single row and overflow scrolls
 * sideways instead of stacking vertically.  Scroll-snap gives a tidy
 * card-by-card feel; `-webkit-overflow-scrolling` keeps it momentum-smooth
 * on touch. */
.cfg-stock-list {
  list-style: none;
  margin: 0;
  padding: 4px 2px 10px;
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.cfg-stock-list[hidden] {
  display: none;
}

.cfg-stock-list::-webkit-scrollbar {
  height: 8px;
}

.cfg-stock-list::-webkit-scrollbar-thumb {
  background: rgba(23, 28, 30, 0.25);
  border-radius: 8px;
}

.cfg-stock-card {
  position: relative; /* anchors .cfg-stock-card__more-wrap below — it's a
   * sibling of .cfg-stock-card__link now, not a descendant (see
   * renderStockCards in configure_map.js for why), so it needs THIS as
   * its positioning context instead. */
  flex: 0 0 auto;
  width: 158px;
  scroll-snap-align: start;
}

/* Card body is now a vertical mini-card (thumbnail on top, text below) so a
 * row of them reads cleanly in the horizontal scroller. A `<button>`, not
 * an `<a>` — clicking the card opens the Full Preview dialog rather than
 * navigating to Shopify (see `renderStockCards` in configure_map.js), so
 * the reset properties below undo the browser's default button chrome
 * (width/font/color/cursor/appearance) to look identical to the plain
 * `text-decoration: none` link this used to be. */
.cfg-stock-card__link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 10px;
  border: 1px solid rgba(23, 28, 30, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-decoration: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  transition: background-color 140ms ease, transform 140ms ease;
}

.cfg-stock-card__link:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

.cfg-stock-card__link:focus-visible {
  outline: 2px solid rgba(12, 119, 190, 0.7);
  outline-offset: 2px;
}

.cfg-stock-card__thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 90px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(12, 119, 190, 0.1);
  color: #0063a3;
  overflow: hidden;
}

.cfg-stock-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* "More options" (⋮) trigger — overlaid on the card's thumbnail (see
 * `buildStockMoreButton` in configure_map.js). Hidden until the card is
 * hovered/focused on desktop (`hover: hover`, below); always shown on
 * touch, where nothing can hover to reveal it — same idiom as the cart
 * page's `.cmc-item__thumb-view` eye icon. The dropdown itself
 * (`.cfg-stock-card-menu`, defined further below) is a SEPARATE, shared,
 * `position: fixed` element appended to `<body>` — NOT a child of this
 * wrap — specifically so it isn't clipped by this thumb's own
 * `overflow: hidden`.
 *
 * A SIBLING of `.cfg-stock-card__link` (positioned here relative to
 * `.cfg-stock-card` itself, the shared `<li>` parent), not a descendant of
 * it — nesting a `<button>` inside `.cfg-stock-card__link`'s own `<button>`
 * would be invalid HTML and an accessibility hazard. The 14px offsets
 * below (rather than a flush 4px) account for `.cfg-stock-card__link`'s
 * own 10px padding, which the thumbnail sits just inside of. */
.cfg-stock-card__more-wrap {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.cfg-stock-card__more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #ffffff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}

@media (hover: hover) {
  /* `.cfg-stock-card:hover`, not `.cfg-stock-card__link:hover` — the
   * more-button is a sibling of `__link` now (see its own comment above),
   * so this has to key off their shared `.cfg-stock-card` (`<li>`) parent
   * instead; hovering `__link` still hovers `.cfg-stock-card` too, since
   * it's `__link`'s own parent, so the reveal behaves identically. */
  .cfg-stock-card:hover .cfg-stock-card__more-btn,
  .cfg-stock-card__more-btn:focus-visible,
  .cfg-stock-card__more-btn[aria-expanded="true"] {
    opacity: 1;
  }
}

/* Touch devices have no hover — show the trigger at rest instead of only on
 * hover, or it would be unreachable (same reasoning as the cart page's own
 * `@media (hover: none)` override for `.cmc-item__thumb-view`). */
@media (hover: none) {
  .cfg-stock-card__more-btn {
    opacity: 1;
  }
}

.cfg-stock-card__more-btn:hover,
.cfg-stock-card__more-btn[aria-expanded="true"] {
  background: rgba(15, 23, 42, 0.8);
}

/* Shared "more options" dropdown for stock cards — a SINGLE fixed-position
 * element appended to `<body>` (see `_ensureStockCardMenu` in
 * configure_map.js), positioned per-card via `getBoundingClientRect()`
 * rather than nested/absolutely-positioned inside each card. It has to live
 * outside the card: `.cfg-stock-card__thumb` clips with `overflow: hidden`
 * (for the thumbnail image) and `.cfg-stock-list` clips with
 * `overflow-x: auto` (for the horizontal scroll strip) — either would cut
 * the flyout off if it were a descendant of either. */
.cfg-stock-card-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 176px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

.cfg-stock-card-menu[hidden] {
  display: none;
}

.cfg-stock-card-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-family: var(--mt-font-primary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.cfg-stock-card-menu__item:hover,
.cfg-stock-card-menu__item:focus-visible {
  background: rgba(0, 99, 163, 0.08);
  color: #006ca2;
  outline: none;
}

/* "Remove from Cart" swap — a warmer/red hover tint (vs the standard blue
 * above) since it's the one destructive action in this menu, matching the
 * cart page's own red-on-hover treatment for its Remove button. */
.cfg-stock-card-menu__item--remove:hover,
.cfg-stock-card-menu__item--remove:focus-visible {
  background: rgba(192, 24, 12, 0.08);
  color: #c0180c;
}

.cfg-stock-card-menu__item svg {
  flex-shrink: 0;
}

/* ---- Full Preview dialog — split view: map on the left, details/options on
 * the right (`.cfg-stock-preview__layout`), with a Shopify-style hover
 * magnifier on the image instead of click/tap zoom steps (see
 * `_applyStockPreviewHoverZoom` in configure_map.js). */
.cfg-stock-preview {
  /* Desktop: larger than the original 920×640 card so the map has more
   * room to inspect; still capped below the viewport so the modal never
   * feels fullscreen. Mobile keeps the stacked layout at the 640px
   * breakpoint below — these caps only apply to the side-by-side view. */
  width: min(1120px, calc(100vw - 32px));
  max-height: min(90vh, 780px);
  padding: 0;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.cfg-stock-preview::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

/* Same chrome as `.cfg-modal__close` (Add-to-Cart review modal) and
 * `.cmc-lightbox__close` (cart page's preview lightbox) — 32x32, 6px
 * corners, transparent → #f2f4f5 on hover, #52595c → #171c1e icon —
 * rather than the circular, dark-overlay button this used to be. Those
 * two sit in a plain white header bar; this one overlays the map image
 * directly (no header here), so it keeps a translucent white backing
 * plate to stay legible over any photo while matching everything else
 * (size, shape, colors, hover) exactly. */
.cfg-stock-preview__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #52595c;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.cfg-stock-preview__close:hover {
  background: #f2f4f5;
  color: #171c1e;
}

.cfg-stock-preview__layout {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-height: min(90vh, 780px);
}

.cfg-stock-preview__media {
  position: relative;
  flex: 1 1 54%;
  min-width: 0;
  background: rgba(12, 119, 190, 0.1);
}

/* `overflow: hidden` — the hover-zoomed image (see below) is scaled +
 * translated via JS transform, never via native scrolling, so there's
 * nothing here for `overflow: auto` to ever need to expose. */
.cfg-stock-preview__img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none; /* this element owns the touch-and-hold zoom gesture, not the page */
}

/* `object-fit: contain` (NOT `cover`) at rest — this is the "see the WHOLE
 * map" preview, so the full image must always be visible, letterboxed
 * against `.cfg-stock-preview__img-wrap`'s background if its aspect ratio
 * doesn't match the box, rather than `cover` cropping off whatever doesn't
 * fit. `.is-zoomed` (set while the pointer is over the image) drops
 * `object-fit` in favor of an explicit JS-set `width`/`height`/`transform`
 * (see `_applyStockPreviewHoverZoom`) that scales the image up and pans it
 * to keep whatever's under the cursor filling the same box — the same
 * "hover to magnify, follow the cursor" idiom Shopify's own PDP zoom uses,
 * rather than a series of discrete zoom-in/zoom-out steps. */
.cfg-stock-preview__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.cfg-stock-preview__img-wrap.is-zoomed {
  cursor: zoom-out;
  /* Definite size is also applied inline by `_setStockPreviewZoomed` —
   * this keeps flex from re-expanding the wrap via `min-height: auto`
   * when the in-flow zoomed image is larger than the resting box. */
  min-height: 0;
}

/* While zoomed, stop the media flex item from growing to fit the
 * oversized in-flow image (`min-height: auto` default). The resting
 * dialog/wrap sizes are frozen in JS; this just keeps the flex layout
 * from fighting those locks. */
.cfg-stock-preview.is-zooming .cfg-stock-preview__media {
  min-height: 0;
  overflow: hidden;
}

.cfg-stock-preview__img-wrap.is-zoomed .cfg-stock-preview__img {
  width: auto;
  height: auto;
  max-width: none;
  object-fit: unset;
  /* Positioning comes entirely from the inline `transform` JS sets on every
   * pointermove — no CSS transition here, since a magnifier that's meant to
   * track the cursor 1:1 should never visibly "catch up" to it. */
}

/* "Hover to zoom" hint — only useful (and only shown) before a shopper has
 * discovered the gesture; once zoomed at least once (`.was-zoomed`, set
 * permanently by `_setStockPreviewZoomed`), showing it again on every
 * re-open of the SAME preview would just be noise. */
.cfg-stock-preview__zoom-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-family: var(--mt-font-primary);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.cfg-stock-preview__img-wrap.was-zoomed .cfg-stock-preview__zoom-hint {
  display: none;
}

/* Shimmering skeleton — shown (via `.is-loading`, toggled by
 * `_setStockPreviewImageSrc` in configure_map.js) while a new image
 * resource is in flight: the initial thumbnail\u2192full-photo upgrade, and
 * every later swap as the shopper changes variant options (different
 * sizes/years/etc. can be genuinely different Shopify photos, so there's a
 * real network fetch each time, not just a decode of something cached). The
 * image itself dims underneath rather than disappearing, so a slow load
 * doesn't leave the box looking empty. */
.cfg-stock-preview__img-wrap.is-loading .cfg-stock-preview__img {
  opacity: 0.15;
}

.cfg-stock-preview__img-wrap.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: linear-gradient(
    100deg,
    rgba(12, 119, 190, 0.06) 30%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(12, 119, 190, 0.06) 70%
  );
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: cfg-stock-preview-shimmer 1.3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cfg-stock-preview-shimmer {
  0% {
    background-position: 140% 0;
  }
  100% {
    background-position: -140% 0;
  }
}

.cfg-stock-preview__body {
  display: flex;
  flex: 1 1 46%;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 18px;
  overflow-y: auto;
}

/* Below this, the two columns don't have room to breathe side-by-side —
 * stack the image above the details instead, same breakpoint idiom as the
 * rest of this page's responsive rules. */
@media (max-width: 640px) {
  .cfg-stock-preview {
    max-height: min(92vh, 720px);
  }

  .cfg-stock-preview__layout {
    flex-direction: column;
    max-height: min(92vh, 720px);
  }

  .cfg-stock-preview__media {
    flex: 0 0 auto;
    height: min(42vh, 320px);
  }

  .cfg-stock-preview__body {
    flex: 1 1 auto;
  }
}

.cfg-stock-preview__title {
  margin: 0;
  font-family: var(--mt-font-primary);
  font-size: 16px;
  font-weight: 700;
  color: #171c1e;
}

.cfg-stock-preview__meta {
  font-size: 12.5px;
  color: #6a6e79;
}

.cfg-stock-preview__price {
  font-family: var(--mt-font-primary);
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.cfg-stock-preview__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cfg-stock-preview__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mt-font-primary);
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.cfg-stock-preview__option select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  font-family: var(--mt-font-primary);
  font-size: 13px;
}

/* Fold/flat toggle (US Topo maps only — see `_isUsTopoType` in
 * configure_map.js) — a plain checkbox+label rather than the
 * `justify-content: space-between` name/`<select>` pair every other
 * option row uses above, since there's no separate "option name" to show
 * alongside a single yes/no choice. */
.cfg-stock-preview__option--fold {
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}

.cfg-stock-preview__option--fold input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0063a3;
  cursor: pointer;
}

.cfg-stock-preview__option--fold span {
  font-weight: 600;
}

.cfg-stock-preview__error {
  font-size: 12.5px;
  color: #c0180c;
}

.cfg-stock-preview__error[hidden] {
  display: none;
}

.cfg-stock-preview__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.cfg-stock-preview__shop-link {
  font-family: var(--mt-font-primary);
  font-size: 12.5px;
  font-weight: 600;
  color: #0063a3;
  text-decoration: none;
}

.cfg-stock-preview__shop-link:hover {
  text-decoration: underline;
}

.cfg-stock-preview__add {
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: #0063a3;
  color: #fff;
  font-family: var(--mt-font-primary);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.cfg-stock-preview__add:hover:not(:disabled) {
  background: #0c77be;
}

.cfg-stock-preview__add:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* "Remove from Cart" state — toggled by `_isStockVariantInCart` in
 * configure_map.js when the currently-selected variant (not just any
 * variant of this product) is already in the cart. Same warmer/red
 * treatment as the ⋮ menu's own `--remove` item and the cart page's
 * Remove button, since it's the one destructive action here. */
.cfg-stock-preview__add--remove {
  background: #c0180c;
}

.cfg-stock-preview__add--remove:hover:not(:disabled) {
  background: #a01309;
}

.cfg-stock-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cfg-stock-card__title {
  font-family: var(--mt-font-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 17px;
  color: #171c1e;
  /* Clamp to two lines so uneven titles keep the cards the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cfg-stock-card__meta {
  font-size: 11px;
  line-height: 14px;
  color: #6a6e79;
}

/* Hover popup — bigger thumbnail + full title/meta for whichever card is
 * currently hovered/focused, shown to the side of it (see `_showStockPopup`
 * in configure_map.js). `position: fixed`, positioned via JS from
 * `getBoundingClientRect()`, and rendered as a TOP-LEVEL sibling of
 * `.cfg-panel` in the markup — see the template comment above this
 * element for why it can't live inside `.cfg-stock-list` or `.cfg-panel`.
 * `pointer-events: none` so it never intercepts the mouse leaving the card
 * that triggered it. */
.cfg-stock-popup {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 260px;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(23, 28, 30, 0.14);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.cfg-stock-popup.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cfg-stock-popup__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* Taller than the strip card's own thumb (and taller than it is wide) —
   * these are scanned USGS quad sheets, almost always portrait, and
   * `object-fit: contain` below needs the extra height so a portrait
   * source doesn't end up tiny inside a landscape box. */
  height: 280px;
  border-radius: 8px;
  background: rgba(12, 119, 190, 0.1);
  color: #0063a3;
  overflow: hidden;
}

.cfg-stock-popup__thumb img {
  width: 100%;
  height: 100%;
  /* `contain`, not `cover` — the `thumbnail` URL from the upstream lookup
   * is actually the FULL-resolution quad scan (confirmed: no separate
   * small/large variant, no embedded crop hint), so `cover` was silently
   * cropping real map content off the sides/top/bottom to fill the box.
   * `contain` always shows the whole image, letterboxed on the shorter
   * axis against the tinted box background above. */
  object-fit: contain;
  display: block;
}

.cfg-stock-popup__title {
  font-family: var(--mt-font-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  color: #171c1e;
}

.cfg-stock-popup__meta {
  font-family: var(--mt-font-primary);
  font-size: 12px;
  line-height: 16px;
  color: #6a6e79;
}

.cfg-stock-popup__meta:empty {
  display: none;
}

/* Live Shopify extras (price range + size/paper options) — appended below
 * the meta line once `/api/stock-maps/details/` resolves. Hidden entirely
 * while empty (nothing fetched yet / fetch failed) via `:empty`, rather
 * than reserving space for a placeholder, so a slow or failed lookup never
 * leaves a visible gap in the popup. */
.cfg-stock-popup__details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* This container ALWAYS has its two child spans present in the markup (see
 * template) -- they're only ever emptied, never removed -- so a CSS
 * `:empty` rule here would never match (that only works on the two CHILD
 * spans' own `:empty` rules below). Visibility is instead driven by JS
 * (`_updateStockPopupDetailsVisibility` in configure_map.js), which toggles
 * this class once it knows whether either child actually got content. */
.cfg-stock-popup__details--empty {
  display: none;
}

.cfg-stock-popup__price {
  font-family: var(--mt-font-primary);
  font-size: 13px;
  font-weight: 700;
  color: #0063a3;
}

.cfg-stock-popup__price:empty {
  display: none;
}

.cfg-stock-popup__options {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--mt-font-primary);
  font-size: 11.5px;
  line-height: 15px;
  color: #52595c;
  padding-top: 2px;
  border-top: 1px solid rgba(23, 28, 30, 0.08);
}

.cfg-stock-popup__options:empty {
  display: none;
  border-top: none;
  padding-top: 0;
}

.cfg-stock-popup__options strong {
  color: #2f343a;
  font-weight: 600;
}

/* Touch-only devices have no hover to drive this, and the fixed-width popup
 * has nowhere good to sit next to a full-width mobile card — same
 * rationale as the cursor-coords hint and hover loupe above. */
@media (hover: none) {
  .cfg-stock-popup {
    display: none;
  }
}

/* ---- Stock-list status rows (loading / empty / error) ------------------- */
.cfg-stock__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 2px;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  line-height: 16px;
  color: #6a6e79;
}

.cfg-stock__status[hidden] {
  display: none;
}

/* Visually-hidden but still screen-reader-visible -- standard "sr-only"
 * clip pattern. Used by the stock-map loading announcement (`#cfg-stock-loading`)
 * now that the VISIBLE loading affordance is the skeleton cards below rather
 * than a spinner + text row. */
.cfg-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Stock-card loading skeleton -----------------------------------------
 * Shown in place of real `.cfg-stock-card` items while a lookup is in
 * flight (`renderStockSkeletons` in configure_map.js) -- same card
 * dimensions/layout as the real thing so the strip doesn't jump/reflow once
 * results replace them. `aria-hidden` since these carry no information; the
 * sr-only status text above is what a screen reader actually hears. */
.cfg-stock-card--skeleton .cfg-stock-card__link {
  cursor: default;
}

.cfg-stock-card--skeleton .cfg-stock-card__link:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: none;
}

.cfg-stock-card__skel {
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    rgba(23, 28, 30, 0.08) 30%,
    rgba(23, 28, 30, 0.15) 50%,
    rgba(23, 28, 30, 0.08) 70%
  );
  background-size: 200% 100%;
  animation: cfg-stock-shimmer 1.4s ease-in-out infinite;
}

.cfg-stock-card__skel--thumb {
  width: 100%;
  height: 90px;
  border-radius: 8px;
}

.cfg-stock-card__skel--title {
  height: 12px;
  width: 92%;
}

.cfg-stock-card__skel--title2 {
  height: 12px;
  width: 62%;
}

.cfg-stock-card__skel--meta {
  height: 10px;
  width: 45%;
  margin-top: 2px;
}

@keyframes cfg-stock-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Respect reduced-motion: keep the placeholder shapes (still useful as a
 * layout preview) but drop the shimmer sweep. */
@media (prefers-reduced-motion: reduce) {
  .cfg-stock-card__skel {
    animation: none;
    background: rgba(23, 28, 30, 0.1);
  }
}

.cfg-stock__retry {
  margin-left: 4px;
  padding: 2px 8px;
  border: 1px solid rgba(12, 119, 190, 0.5);
  border-radius: 6px;
  background: transparent;
  color: #0063a3;
  font: inherit;
  cursor: pointer;
}

.cfg-stock__retry:hover {
  background: rgba(12, 119, 190, 0.1);
}

/* ---------------------------------------------------------------------------
 * 3. Form — rows of (label | control | optional hint)
 * ------------------------------------------------------------------------- */
.cfg-form {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 20px 0;
  margin: 0;
}

.cfg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
}

.cfg-row__label {
  width: 167px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
  color: #171c1e;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.cfg-row__req {
  color: #da212c;
  font-weight: 700;
  line-height: 1;
}

.cfg-row__control {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  width: 370px;
  min-width: 0;
}

.cfg-row__control--group {
  flex: 1 1 auto;
  width: auto;
  max-width: 600px;
}

.cfg-row__hint {
  margin: 0;
  flex: 0 1 238px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 400;
  /* Dark slate (was #6a6e79) so hint text — e.g. "Current map center (read
   * only)" and "Special characters & and + not allowed" — stays legible when
   * the translucent panel floats over dark satellite / hybrid imagery. */
  color: #2f343a;
}

/* ---- Text input ---------------------------------------------------------- */
.cfg-input {
  width: 100%;
  height: 32px;
  padding: 4px 12px;
  background: var(--mt-input-bg);
  border: 1px solid var(--mt-input-border-default);
  border-radius: var(--mt-input-radius);
  font-family: var(--mt-font-primary);
  font-size: 13px;
  line-height: 24px;
  color: #000000;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.cfg-input::placeholder {
  color: var(--mt-input-placeholder);
}

.cfg-input:not(:placeholder-shown) {
  border-color: var(--mt-input-border-filled);
}

.cfg-input:focus {
  border: 1px solid var(--mt-input-border-focus);
  outline: 2px solid var(--mt-input-shadow-focus);
  outline-offset: 3px;
}

.cfg-input:invalid:not(:focus):not(:placeholder-shown) {
  border-color: var(--mt-input-border-invalid);
}

/* Required-title cue — set by `flagTitleRequired()` in configure_map.js when a
 * preview or add-to-cart is attempted with an empty title.  Previews silently
 * focused the title before, which on the collapsed preview menu looked like
 * "nothing happened"; this makes the reason explicit.  `!important` so the red
 * border wins over the `:focus` rule (we focus the field at the same time).
 * Cleared on the next input event. */
.cfg-input--error,
.cfg-input--error:focus {
  border-color: var(--mt-input-border-invalid) !important;
  outline-color: var(--mt-input-border-invalid);
}

.cfg-row__hint--error {
  color: var(--mt-input-border-invalid);
  font-weight: 600;
}

/* Read-only fields (e.g. the live map-centre coordinates) — visually
   distinct, non-editable, and skipped by keyboard tabbing. */
.cfg-input--readonly,
.cfg-input[readonly] {
  background: #f1f3f4;
  color: #3c4043;
  border-color: var(--mt-input-border-default);
  cursor: default;
}

.cfg-input--readonly:focus,
.cfg-input[readonly]:focus {
  border-color: var(--mt-input-border-default);
  outline: none;
}

/* ---- Select dropdown ----------------------------------------------------- */
.cfg-select-wrapper {
  position: relative;
  width: 100%;
}

.cfg-select {
  width: 100%;
  height: 32px;
  padding: 0 36px 0 12px;
  background: #f1f1f6;
  border: 0;
  border-radius: 8px;
  font-family: var(--mt-font-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 14px;
  color: #171c1e;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.cfg-select:hover {
  background-color: #e6e7ee;
}

.cfg-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(12, 119, 190, 0.4);
}

.cfg-select-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #171c1e;
}

/* ---- Segmented button group --------------------------------------------- */
.cfg-segmented {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.cfg-seg {
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #939393;
  background: #f1f1f6;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 14px;
  color: #171c1e;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: background-color 120ms ease, color 120ms ease;
}

.cfg-seg:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.cfg-seg:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-right: 0;
}

.cfg-seg:hover {
  background-color: #e6e7ee;
}

.cfg-seg.is-active {
  background: #0063a3;
  color: #ffffff;
}

.cfg-seg.is-active:hover {
  background: #0c77be;
}

.cfg-seg:focus-visible {
  outline: 2px solid rgba(12, 119, 190, 0.4);
  outline-offset: 2px;
  z-index: 1;
}

/* ---- Sliding selection highlight ("thumb") -------------------------------
 * A single blue pill per group (injected by JS) that travels from the old
 * selection to the new one instead of the active button snapping blue.
 * The group clips it to its rounded corners via `overflow: hidden`. */
.cfg-seg__thumb {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  z-index: 0;
  background: #0063a3;
  pointer-events: none;
  opacity: 0;
  transform: translateX(0);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
    width 300ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 120ms ease;
}

/* With the travelling thumb active, buttons go transparent (so the thumb
 * shows through and slides across the full track) and the group itself
 * carries the inactive track fill. */
.cfg-segmented.has-thumb {
  background: #f1f1f6;
}

.cfg-segmented.has-thumb .cfg-seg {
  position: relative;
  z-index: 1;
  background: transparent;
}

.cfg-segmented.has-thumb .cfg-seg:hover:not(.is-active):not([disabled]) {
  background: #e6e7ee;
}

.cfg-segmented.has-thumb .cfg-seg.is-active,
.cfg-segmented.has-thumb .cfg-seg.is-active:hover {
  background: transparent;
  color: #ffffff;
}

.cfg-segmented.has-thumb .cfg-seg[disabled] {
  background: #ececf0;
}

/* Brighten the pill while hovering the active option (parity with the old
 * `.is-active:hover` blue shift). */
.cfg-segmented.has-thumb:has(.cfg-seg.is-active:hover) .cfg-seg__thumb {
  background: #0c77be;
}

/* Disabled segmented buttons stay visible (so the user can see the
 * option exists) but are clearly inactive and reveal a hover-hint
 * via their native `title` tooltip.  Click + keyboard activation
 * are blocked in the JS handler (see the `btn.disabled` guards in
 * the `.cfg-segmented` setup loop). */
.cfg-seg[disabled] {
  cursor: not-allowed;
  color: #8a8f93;
  background-color: #ececf0;
  opacity: 0.65;
}

.cfg-seg[disabled]:hover {
  background-color: #ececf0;
}

/* ---- Grid card fieldset (Lat/Lng + UTM grouped) ------------------------- */
.cfg-grid-card {
  margin: 0;
  padding: 14px 0;
  /* No added white "fog" — keep the tint minimal and instead set the card
   * apart from the panel purely with a stronger blur (panel blurs 20px,
   * this 32px) so it reads as a deeper-frosted glass pane. */
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  backdrop-filter: blur(32px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cfg-grid-card__legend {
  display: none;
}

.cfg-row--grid .cfg-seg {
  height: 40px;
  font-size: 12px;
  line-height: 28px;
  padding: 0 16px;
}

/* ---- Glassmorphism form controls ----------------------------------------
 * The options panel (and the near-transparent grid card inside it) let the
 * map show through, so the default flat light-grey controls lose their
 * edges.  Give every field in the form a "mounted glass chip" look: a
 * translucent white fill so the map shows through, a legible outline, a
 * soft drop shadow, and a faint inner top highlight.  Scoped to `.cfg-form`
 * so buttons in the top bar / preview overlays (`.cfg-btn`, `.cfg-cart-btn`)
 * keep their solid treatment. */
.cfg-form .cfg-segmented {
  box-sizing: border-box;
  border: 1px solid rgba(23, 28, 30, 0.22);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.cfg-form .cfg-seg {
  background: rgba(255, 255, 255, 0.55);
  border-right-color: rgba(23, 28, 30, 0.18);
  transition: background-color 140ms ease, color 140ms ease,
    box-shadow 140ms ease;
}

/* Hovering an unselected option greys the glass fill (matching the standard
 * segmented buttons elsewhere); the selected blue chip brightens on hover
 * via the `.is-active:hover` rule below. */
.cfg-form .cfg-seg:hover {
  background: rgba(230, 231, 238, 0.85);
}

/* Keep the selected state a solid blue chip so it clearly stands out. */
.cfg-form .cfg-seg.is-active {
  background: #0063a3;
}

.cfg-form .cfg-seg.is-active:hover {
  background: #0c77be;
}

/* Disabled options stay flat and unreactive — no glass fill, no hover. */
.cfg-form .cfg-seg[disabled],
.cfg-form .cfg-seg[disabled]:hover {
  background: rgba(236, 236, 240, 0.6);
}

/* Sliding-thumb overrides inside the panel's glass segmented controls: the
 * group keeps the translucent track fill, buttons go transparent so the blue
 * thumb travels across, and the active option's colour is the thumb itself. */
.cfg-form .cfg-segmented.has-thumb {
  background: rgba(255, 255, 255, 0.55);
}

.cfg-form .cfg-segmented.has-thumb .cfg-seg {
  background: transparent;
}

.cfg-form
  .cfg-segmented.has-thumb
  .cfg-seg:hover:not(.is-active):not([disabled]) {
  background: rgba(230, 231, 238, 0.85);
}

.cfg-form .cfg-segmented.has-thumb .cfg-seg.is-active,
.cfg-form .cfg-segmented.has-thumb .cfg-seg.is-active:hover {
  background: transparent;
}

.cfg-form .cfg-segmented.has-thumb .cfg-seg[disabled],
.cfg-form .cfg-segmented.has-thumb .cfg-seg[disabled]:hover {
  background: rgba(236, 236, 240, 0.6);
}

.cfg-form .cfg-select {
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 28, 30, 0.22);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Match the GMU dropdown's hover — grey the fill rather than brightening
 * the translucent white. */
.cfg-form .cfg-select:hover {
  background: rgba(230, 231, 238, 0.85);
}

/* Text inputs get the same glassy fill + mounted shadow.  The border colour
 * is left to the base `.cfg-input` (and its focus/filled/invalid state
 * rules) so validation feedback still reads correctly. */
.cfg-form .cfg-input {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.cfg-form .cfg-input:hover {
  background: rgba(255, 255, 255, 0.72);
}

/* ---- Checkbox + checkbox grid (overlays, hillshade) --------------------- */
.cfg-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mt-font-primary);
  font-size: 13px;
  line-height: 16px;
  color: #171c1e;
  cursor: pointer;
  user-select: none;
}

.cfg-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #0063a3;
  cursor: pointer;
}

.cfg-check input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.cfg-check input[type="checkbox"]:disabled + span {
  /* Darker muted slate (was #a3a6b1) — keeps the disabled cue while staying
   * readable over dark satellite / hybrid imagery, e.g. "Add hillshade to
   * topo base" when the option is disabled. */
  color: #4b5159;
}

/* ?base_bridge=4 — overlay has no data inside the red print frame (set by
 * the PostGIS availability check in configure_map.js).  The checkbox is
 * already disabled (greying its label via the rule above); this dims the
 * whole row and flips the cursor so the "not offered here" cue is obvious. */
.cfg-check--unavailable {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ?base_bridge=4 — dismissable error toast, bottom-right of the viewport.
 * Surfaced when the PostGIS overlay-availability check can't be answered
 * (spatial DB / overlay data unreachable), in which case the overlay
 * checkboxes are disabled (fail-closed).  A <dialog> (the cart modal) renders
 * in the top layer above this, which is intended. */
.cfg-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.cfg-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fde2e4;
  color: #8b0000;
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  padding: 12px 12px 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  line-height: 1.45;
  animation: cfg-toast-in 150ms ease-out;
}

.cfg-toast__icon {
  font-weight: 700;
  flex: 0 0 auto;
}

.cfg-toast__body {
  flex: 1 1 auto;
}

.cfg-toast__title {
  font-weight: 700;
  margin-bottom: 2px;
}

.cfg-toast__close {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}

.cfg-toast__close:hover {
  opacity: 1;
}

/* Warning variant — yellow, used for transient "you can't do that right now"
 * nudges (e.g. clicking Preview / Add to Cart while in move-the-print-box
 * edit mode).  Auto-dismisses after a few seconds (see `showToast` /
 * `_armToastAutoDismiss` in configure_map.js) but keeps the × so it can be
 * closed early. */
.cfg-toast--warning {
  background: #fff6da;
  color: #7a5b00;
  border-color: #f0dd8a;
}

/* Success variant — green, used for positive confirmations (e.g. finishing
 * the guided edit-mode tour, section 19 of configure_map.js). Same
 * auto-dismiss/× behaviour as `--warning` (see `showToast`). */
.cfg-toast--success {
  background: #e3f6ea;
  color: #14532d;
  border-color: #a7dcb8;
}

/* Preview + Add to Cart are locked while the print box is being moved (edit
 * mode) — greyed out for an obvious "disabled" cue, but pointer-events stay
 * on so a click still reaches the handler and surfaces the warning toast
 * explaining why (see `cfg-is-editing` toggling in configure_map.js). */
.cfg-is-editing #cfg-preview-cta,
.cfg-is-editing #cfg-submit {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes cfg-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cfg-check-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 24px;
  row-gap: 10px;
  width: 100%;
}

.cfg-row--align-top {
  align-items: flex-start;
}

.cfg-row--align-top .cfg-row__label {
  padding-top: 2px;
}

.cfg-row__sublabel {
  display: inline-block;
  margin-left: 4px;
  font-weight: 400;
  font-size: 11px;
  color: #6a6e79;
}

.cfg-row[hidden] {
  display: none;
}

/* ---- Action row (Cancel | Add to Cart) ---------------------------------- */
.cfg-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid #7b7b7b;
}

.cfg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font-family: var(--mt-font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 28px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.cfg-btn--secondary {
  background: #f1f1f6;
  color: #171c1e;
  min-width: 107px;
}

.cfg-btn--secondary:hover,
.cfg-btn--secondary:focus-visible {
  background-color: #e6e7ee;
  outline: none;
}

.cfg-btn--primary {
  background: #0063a3;
  color: #ffffff;
}

.cfg-btn--primary:hover,
.cfg-btn--primary:focus-visible {
  background-color: #0c77be;
  outline: none;
}

.cfg-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(12, 119, 190, 0.4);
}

.cfg-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
 * 4. Map preview pane — fills the right column edge-to-edge.
 *    Info overlay, USGS toggle, and Preview button are absolutely
 *    positioned over the map so the canvas stays uninterrupted.
 * ------------------------------------------------------------------------- */
.cfg-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #d8d6cd;
  overflow: hidden;
}

.cfg-preview__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The WMS preview image, full-bleed overlay shown only when the
 * view-mode toggle is active.  The WMS request is at the actual
 * paper aspect + the user's literal print scale (see
 * `configure_map.js` `wmsGeometry`), so this image IS the print —
 * `object-fit: contain` letterboxes it into the pane without
 * cropping. */
.cfg-preview__wms {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  /* Inset the WMS image's left edge by the panel offset so its letterboxed
   * (`object-fit: contain`) centre lands in the same right-side region the
   * Mapbox camera centre uses. */
  left: var(--cfg-map-offset, 0px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #2a2a2a;
  display: block;
  z-index: 1;
}

.cfg-preview__wms-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 8px 14px;
  background: rgba(33, 33, 33, 0.85);
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  font-family: var(--mt-font-primary);
  font-size: 13px;
  color: #171c1e;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cfg-preview__wms-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #cbcdd6;
  border-top-color: #0063a3;
  border-radius: 50%;
  animation: cfgSpin 800ms linear infinite;
}

@keyframes cfgSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Mapbox built-in control containers (NavigationControl, attribution,
 * scale, plus any custom absolute-positioned overlays like Recenter)
 * live inside the map element and get NO explicit z-index from
 * Mapbox.  That means they stack at `auto` — i.e. UNDER any sibling
 * with an explicit z-index ≥ 1.
 *
 * The print-frame `.cfg-preview__wms-frame` uses an outset
 * `box-shadow: 0 0 0 9999px rgba(20,20,20,.25)` at z-index 2 to
 * paint the "dark mask outside the red box" effect.  Without
 * intervention, that mask draws OVER the Mapbox controls, dimming
 * them and (visually) hiding them whenever the red box is on
 * screen.
 *
 * Lifting all four corner containers to z-index 3 puts the buttons
 * on the same plane as our custom toggles (usgs / view / fullscreen,
 * all z-index 3) — above the mask, but still below the loupe (z:4)
 * and the WMS loading spinner (z:5).  The map's *terrain* underneath
 * stays correctly dimmed by the mask; only the controls poke
 * through. */
.cfg-preview__map .mapboxgl-ctrl-top-right,
.cfg-preview__map .mapboxgl-ctrl-top-left,
.cfg-preview__map .mapboxgl-ctrl-bottom-right,
.cfg-preview__map .mapboxgl-ctrl-bottom-left {
  z-index: 3;
}

/* Push the native top control group (zoom stack) clear of the
 * floating top bar that now overlaps the top of the map. */
.cfg-preview__map .mapboxgl-ctrl-top-right,
.cfg-preview__map .mapboxgl-ctrl-top-left {
  margin-top: var(--cfg-topbar-h);
}

/* USGS quad grid toggle — sits to the LEFT of the zoom stack
 * (Mapbox parks zoom at top:10/right:10 with 32px width).  We use
 * right: 52px (10 edge + 32 nav + 10 gap) so the toggle reads as part of
 * the same control cluster. */

/* Recenter — same absolute square chrome as Move / Fullscreen /
 * Street View. Sits directly under the 64px zoom stack:
 *   10 inset + 64 zoom + 10 gap = 84px (+ topbar).
 * Kept out of `.mapboxgl-ctrl-group` on purpose: Mapbox locks those
 * buttons to `width: 29px`, which made expand-on-hover pop instead
 * of animating `max-width`. */
.cfg-preview__recenter-btn {
  position: absolute;
  top: calc(84px + var(--cfg-topbar-h));
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.cfg-preview__recenter-btn:hover {
  background-color: #f1f1f6;
}

.cfg-preview__recenter-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.cfg-preview__usgs-toggle {
  position: absolute;
  top: calc(10px + var(--cfg-topbar-h));
  right: 52px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 14px;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  transition: background-color 120ms ease, color 120ms ease, right 220ms ease;
}

/* Slide the USGS toggle left just far enough to keep the same 10px
 * gap it has against the icon-only zoom stack, while either zoom
 * button is expanded. The target `right` is NOT hardcoded -- JS
 * (`_wireUsgsZoomClearance` in configure_map.js) measures the
 * hovered button's full content width (label scrollWidth + 32px icon)
 * and writes it onto this element as an inline `right`, matching the
 * resting formula `10 (ctrl inset) + width + 10 (gap)` that yields
 * the resting `52px` when width is 32. The existing
 * `transition: right 220ms` above keeps the nudge in sync with the
 * button's own max-width expand animation.
 *
 * Purely a cosmetic position nudge -- does NOT touch the USGS
 * button's own dev-only gating (`{% if BASE_BRIDGE_ENABLED %}` in the
 * template) or behaviour; that stays exactly as it was. */

.cfg-preview__usgs-toggle[aria-pressed="true"] {
  background: #0063a3;
  color: #ffffff;
}

.cfg-preview__usgs-toggle:hover {
  background-color: #f1f1f6;
}

.cfg-preview__usgs-toggle[aria-pressed="true"]:hover {
  background-color: #0c77be;
}

.cfg-preview__usgs-label {
  display: inline-block;
}

/* Move-the-print-box toggle (4-way move icon) — first control BELOW the zoom
 * stack and Recenter (same absolute pattern). Stack height:
 *   leading margin                           = 10 px
 *   ZoomControl (2 × 32 px)                  = 64 px
 *   inter-control gap                        = 10 px
 *   Recenter (1 × 32 px)                     = 32 px
 *   ─────────────────────────────────────────────────
 *   total                                    ≈ 116 px → start at 126 px
 *                                              (keeps the same 10 px gap)
 * Sits directly ABOVE the fullscreen button.  Same square icon-button
 * treatment as its neighbours; `aria-pressed="true"` (blue) signals
 * that edit mode is active. */
.cfg-preview__edit-toggle {
  position: absolute;
  top: calc(126px + var(--cfg-topbar-h));
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.cfg-preview__edit-toggle[aria-pressed="true"] {
  background: #0063a3;
  color: #ffffff;
}

.cfg-preview__edit-toggle:hover {
  background-color: #f1f1f6;
}

.cfg-preview__edit-toggle[aria-pressed="true"]:hover {
  background-color: #0c77be;
}

/* Edit-mode toolbar — floats at the top-centre of the preview while
 * the move-print-box toggle is active.  Holds the contextual hint plus
 * the Revert / Save actions. */
.cfg-preview__edit-bar {
  position: absolute;
  top: calc(15px + var(--cfg-topbar-h));
  /* Centre within the right-side map region (to the right of the panel)
   * rather than the full viewport — mirrors the Print-Preview CTA so it
   * stays in the visible map area whether the panel is collapsed
   * (offset 0 → true centre) or expanded (offset = panel width). */
  left: calc(50% + var(--cfg-map-offset, 0px) / 2);
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 8px 6px 14px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: left 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cfg-preview__edit-bar[hidden] {
  display: none !important;
}

.cfg-preview__edit-hint {
  font-size: 12px;
  line-height: 16px;
  color: #3c4043;
  max-width: 360px;
}

.cfg-preview__edit-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid #c4c7c5;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.cfg-preview__edit-btn:hover {
  background-color: #f1f1f6;
}

.cfg-preview__edit-btn--primary {
  border-color: #0063a3;
  background: #0063a3;
  color: #ffffff;
}

.cfg-preview__edit-btn--primary:hover {
  background-color: #0c77be;
}

/* Fullscreen toggle — sits directly below the move toggle
 * (edit-toggle at top:126, 32 px tall + 10 px gap = top:168 px) so
 * the right-edge control stack reads as a single tool group: Mapbox
 * nav, recenter, move-box, fullscreen.  Same 32 px square treatment as
 * its neighbours for consistency; the `aria-pressed="true"` blue swap
 * doubles as the "currently in fullscreen" indicator when the user is
 * viewing the pane expanded. */
.cfg-preview__fullscreen-toggle {
  position: absolute;
  top: calc(168px + var(--cfg-topbar-h));
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  transition: background-color 120ms ease, color 120ms ease;
}

.cfg-preview__fullscreen-toggle[aria-pressed="true"] {
  background: #0063a3;
  color: #ffffff;
}

.cfg-preview__fullscreen-toggle:hover {
  background-color: #f1f1f6;
}

.cfg-preview__fullscreen-toggle[aria-pressed="true"]:hover {
  background-color: #0c77be;
}

/* The single SVG inside the fullscreen button.  The JS rewrites the
 * inner <path>'s `d` attribute on `fullscreenchange` to morph the
 * icon between "expand" arrows (default) and "collapse" arrows (in
 * fullscreen) — no display:none / hidden swaps needed. */
.cfg-preview__fs-icon {
  display: block;
}

.cfg-preview__fs-icon path {
  transition: d 150ms ease;
}

/* Street View toggle — sits directly below fullscreen (168 + 32 + 10 =
 * 210) continuing the same right-edge stack rhythm. Same 32 px square
 * treatment; `aria-pressed="true"` blue swap doubles as the "Street View
 * is active" indicator, same as its neighbours. */
.cfg-preview__streetview-toggle {
  position: absolute;
  top: calc(210px + var(--cfg-topbar-h));
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171c1e;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  transition: background-color 120ms ease, color 120ms ease;
}

.cfg-preview__streetview-toggle svg {
  fill: currentColor;
}

.cfg-preview__streetview-toggle[aria-pressed="true"] {
  background: #0063a3;
  color: #ffffff;
}

.cfg-preview__streetview-toggle:hover {
  background-color: #f1f1f6;
}

.cfg-preview__streetview-toggle[aria-pressed="true"]:hover {
  background-color: #0c77be;
}

/* While Street View is on, Preview / Add to Cart / base-map-type selection
 * are all locked (see `setStreetViewActive` in configure_map.js) — greyed
 * out for the "disabled" cue, but pointer-events stay on so a click still
 * reaches the handler and surfaces the warning toast, same pattern as
 * `cfg-is-editing` above. */
body.cfg-street-view-active #cfg-preview-cta,
body.cfg-street-view-active #cfg-submit,
body.cfg-street-view-active .cfg-segmented[data-name="mapsource"] {
  opacity: 0.5;
  cursor: not-allowed;
}

body.cfg-street-view-active .cfg-segmented[data-name="mapsource"] .cfg-seg {
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Icon-button "expand on hover" -- ONE component, two states           */
/* ------------------------------------------------------------------ */

/* Shared by every icon-only right-edge map control EXCEPT the zoom
 * unit (that has its own `.cfg-zoom-ctrl` chrome) — Recenter, Move
 * print box, Fullscreen, Street View — wired up in
 * `configure_map.js`'s `_wireExpandOnHover`. Zoom still uses that
 * helper for the label+icon DOM, but its ring/shadow lives only under
 * `.cfg-zoom-ctrl`.
 *
 * ONE box, two states (icon-only / expanded). DOM from the helper is
 * always `[.cfg-map-btn__label][.cfg-map-btn__icon]`. Combined with
 * `justify-content: flex-end` that packs content to the RIGHT edge of
 * the button:
 *   - Rest (width 32px, overflow hidden): only the icon shows — the
 *     label is clipped off the left side of the box.
 *   - Hover/focus (width grows, right edge stays put via `right:` on
 *     every button that uses this): the box grows LEFTWARD and the
 *     label is revealed. Icon never moves.
 *
 * There is exactly one background, one box-shadow ring, one hover
 * grey — no separate "label chrome" to keep in sync with the button. */

.cfg-map-btn--expand {
  display: flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  box-sizing: border-box;
  /* `width: max-content` + a clamping `max-width` is what makes the
   * expand animate: only `max-width` transitions (32 → 180), and the
   * used width follows as min(content, max-width). A bare
   * `width: 32px → max-content` jump is NOT interpolable, so the
   * button would pop instead of slide. */
  width: max-content;
  max-width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0 !important;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 220ms ease, background-color 120ms ease;
}

.cfg-map-btn__icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cfg-map-btn__icon .mapboxgl-ctrl-icon {
  /* Mapbox paints the +/- glyph on this span via background-image.
   * Keep it filling the 32px icon slot after we wrap it. */
  display: block;
  width: 32px;
  height: 32px;
}

.cfg-map-btn__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.cfg-map-btn__label {
  flex: 0 0 auto;
  padding: 0 0 0 10px;
  overflow: hidden;
  white-space: nowrap;
  color: inherit;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 14px;
}

/* Expanded state — shared by every wired button. Width must win over
 * Mapbox's `.mapboxgl-ctrl-group button { width: 32px }` (0,1,1) AND
 * our own resting rule above, so hover/focus selectors are at least
 * as specific as the resting Mapbox+expand rule below (0,2,1). */
.cfg-map-btn--expand:hover,
.cfg-map-btn--expand:focus-visible {
  background-color: #f1f1f6;
}

[aria-pressed="true"].cfg-map-btn--expand:hover,
[aria-pressed="true"].cfg-map-btn--expand:focus-visible {
  background-color: #0c77be;
}

/* ------------------------------------------------------------------ */
/* Zoom In / Zoom Out — dedicated unit (`.cfg-zoom-ctrl`)               */
/* ------------------------------------------------------------------ */
/*
 * Separate from the shared `.cfg-map-btn--expand` / Mapbox group chrome
 * on purpose: Zoom In + Zoom Out are ONE visual unit. Shadow rules:
 *   Rest    → ring on the UNIT (this container), never on each button.
 *   Expand  → unit ring OFF; expanded button gets its own outline
 *             (clipped at the sibling seam); the resting sibling keeps
 *             its own ring so it doesn't go "naked" while the other is
 *             open. Sibling ring sits under the expanded button
 *             (lower z-index) so it never paints on top of it.
 *
 * Buttons still use `_wireExpandOnHover` (label+icon flex row). */

.cfg-zoom-ctrl {
  position: relative;
  width: 32px;
  height: 64px;
  overflow: visible;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Expanded: drop the unit ring — each button carries its own frame. */
.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__btn:hover),
.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__btn:focus-visible) {
  background: transparent;
  box-shadow: none;
}

.cfg-zoom-ctrl__btn {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  z-index: 1;
  display: flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  box-sizing: border-box;
  width: max-content;
  max-width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0 !important;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #171c1e;
  box-shadow: none;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  transition: max-width 220ms ease, background-color 120ms ease;
}

.cfg-zoom-ctrl__btn:first-child {
  border-radius: 4px 4px 0 0;
}

.cfg-zoom-ctrl__out {
  top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0 0 4px 4px;
}

/* Hover grey MUST beat Mapbox's `.mapboxgl-ctrl button:hover`
 * (`rgba(0,0,0,0.05)` — a lighter wash) so Zoom matches Recenter /
 * Edit / Fullscreen / Street View (`#f1f1f6`). */
.mapboxgl-ctrl.cfg-zoom-ctrl .cfg-zoom-ctrl__btn:hover,
.mapboxgl-ctrl.cfg-zoom-ctrl .cfg-zoom-ctrl__btn:focus-visible {
  max-width: 180px;
  z-index: 2;
  background-color: #f1f1f6;
  border-top-color: transparent;
  /* Resting `overflow: hidden` clips the label; must open on expand so
   * the ::after outline (inset -2px) isn't clipped with it. */
  overflow: visible;
}

/* Seam with the sibling stays SQUARE — only the free corners round.
 * Otherwise the expanded button reads as a separate pill floating on
 * top of the stack (rounded BR on Zoom In / TR on Zoom Out). */
.cfg-zoom-ctrl__in:hover,
.cfg-zoom-ctrl__in:focus-visible {
  /* TL TR BR BL — BR = 0 against Zoom Out */
  border-radius: 4px 4px 0 4px;
}

.cfg-zoom-ctrl__out:hover,
.cfg-zoom-ctrl__out:focus-visible {
  /* TL TR BR BL — TR = 0 against Zoom In */
  border-radius: 4px 0 4px 4px;
}

.cfg-zoom-ctrl__btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cfg-zoom-ctrl__btn:disabled:hover,
.cfg-zoom-ctrl__btn:disabled:focus-visible {
  max-width: 32px;
  background: #ffffff;
  border-radius: inherit;
  overflow: hidden;
}

/* Outline for the expanded shape only. Clipped on the sibling seam
 * so the ring never sits on top of the other zoom button. Radius
 * mirrors the button (square on the shared corner). */
.cfg-zoom-ctrl__btn:hover::after,
.cfg-zoom-ctrl__btn:focus-visible::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  pointer-events: none;
  box-sizing: border-box;
}

/* Zoom In: keep full outline except the bottom edge over the icon
 * column (that edge would land on Zoom Out). */
.cfg-zoom-ctrl__in:hover::after,
.cfg-zoom-ctrl__in:focus-visible::after {
  border-radius: 6px 6px 0 6px;
  clip-path: polygon(
    0% 0%,
    100% 0%,
    100% calc(100% - 2px),
    calc(100% - 34px) calc(100% - 2px),
    calc(100% - 34px) 100%,
    0% 100%
  );
}

/* Zoom Out: keep full outline except the top edge over the icon
 * column (that edge would land on Zoom In). */
.cfg-zoom-ctrl__out:hover::after,
.cfg-zoom-ctrl__out:focus-visible::after {
  border-radius: 6px 0 6px 6px;
  clip-path: polygon(
    0% 0%,
    calc(100% - 34px) 0%,
    calc(100% - 34px) 2px,
    100% 2px,
    100% 100%,
    0% 100%
  );
}

.cfg-zoom-ctrl__btn:disabled:hover::after,
.cfg-zoom-ctrl__btn:disabled:focus-visible::after {
  content: none;
}

/* Keep the resting sibling framed while the other expands. Seam-side
 * corners stay square so the column still reads as one unit. Sibling
 * ring sits under the expanded button (lower z-index). */
.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__in:hover) .cfg-zoom-ctrl__out:not(:hover):not(:focus-visible),
.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__in:focus-visible) .cfg-zoom-ctrl__out:not(:hover):not(:focus-visible) {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  border-radius: 0 0 4px 4px;
}

.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__out:hover) .cfg-zoom-ctrl__in:not(:hover):not(:focus-visible),
.cfg-zoom-ctrl:has(.cfg-zoom-ctrl__out:focus-visible) .cfg-zoom-ctrl__in:not(:hover):not(:focus-visible) {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  border-radius: 4px 4px 0 0;
}

/* Let expanded Mapbox / zoom controls spill left out of the corner
 * stack without being clipped by Mapbox's control container. */
.cfg-preview__map .mapboxgl-ctrl-top-right {
  overflow: visible;
}

/* -- Custom square toggles (recenter / edit / fullscreen / streetview) - */
/*
 * Already `position: absolute; right: 10px` from their own rules.
 * Resting width is also set there; hover must beat that single-class
 * `width: 32px` — pair the toggle class with `:hover` so specificity
 * wins cleanly. */
.cfg-preview__recenter-btn.cfg-map-btn--expand,
.cfg-preview__edit-toggle.cfg-map-btn--expand,
.cfg-preview__fullscreen-toggle.cfg-map-btn--expand,
.cfg-preview__streetview-toggle.cfg-map-btn--expand {
  width: max-content;
  max-width: 32px;
  min-width: 32px;
  justify-content: flex-end;
  overflow: hidden;
}

.cfg-preview__recenter-btn.cfg-map-btn--expand:hover,
.cfg-preview__recenter-btn.cfg-map-btn--expand:focus-visible,
.cfg-preview__edit-toggle.cfg-map-btn--expand:hover,
.cfg-preview__edit-toggle.cfg-map-btn--expand:focus-visible,
.cfg-preview__fullscreen-toggle.cfg-map-btn--expand:hover,
.cfg-preview__fullscreen-toggle.cfg-map-btn--expand:focus-visible,
.cfg-preview__streetview-toggle.cfg-map-btn--expand:hover,
.cfg-preview__streetview-toggle.cfg-map-btn--expand:focus-visible {
  max-width: 180px;
}

/* Touch / coarse pointers: lock every expand control at the icon-only
 * footprint. Sticky `:hover` after a tap on iOS otherwise leaves a wide
 * label covering the map, and there's no real hover to drive the
 * reveal. Native `title` tooltips are restored in `_wireExpandOnHover`. */
@media (hover: none), (pointer: coarse) {
  .cfg-map-btn--expand:hover,
  .cfg-map-btn--expand:focus-visible,
  .cfg-preview__recenter-btn.cfg-map-btn--expand:hover,
  .cfg-preview__recenter-btn.cfg-map-btn--expand:focus-visible,
  .cfg-preview__edit-toggle.cfg-map-btn--expand:hover,
  .cfg-preview__edit-toggle.cfg-map-btn--expand:focus-visible,
  .cfg-preview__fullscreen-toggle.cfg-map-btn--expand:hover,
  .cfg-preview__fullscreen-toggle.cfg-map-btn--expand:focus-visible,
  .cfg-preview__streetview-toggle.cfg-map-btn--expand:hover,
  .cfg-preview__streetview-toggle.cfg-map-btn--expand:focus-visible,
  .cfg-zoom-ctrl__btn:hover,
  .cfg-zoom-ctrl__btn:focus-visible,
  .mapboxgl-ctrl.cfg-zoom-ctrl .cfg-zoom-ctrl__btn:hover,
  .mapboxgl-ctrl.cfg-zoom-ctrl .cfg-zoom-ctrl__btn:focus-visible {
    max-width: 32px;
    overflow: hidden;
    border-radius: inherit;
  }

  .cfg-zoom-ctrl:has(.cfg-zoom-ctrl__btn:hover),
  .cfg-zoom-ctrl:has(.cfg-zoom-ctrl__btn:focus-visible) {
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  }

  .cfg-zoom-ctrl__btn:hover::after,
  .cfg-zoom-ctrl__btn:focus-visible::after {
    content: none;
  }

  .cfg-zoom-ctrl:has(.cfg-zoom-ctrl__in:hover) .cfg-zoom-ctrl__out:not(:hover),
  .cfg-zoom-ctrl:has(.cfg-zoom-ctrl__out:hover) .cfg-zoom-ctrl__in:not(:hover) {
    box-shadow: none;
  }
}

/* ------------------------------------------------------------------ */
/* Hover loupe                                                         */
/* ------------------------------------------------------------------ */

/* Small circular secondary Mapbox map pinned to the bottom-right of
 * the preview pane.  Re-centers on the lng/lat under the cursor at
 * main-zoom + 3.  `pointer-events: none` is critical — without it the
 * loupe would swallow mousemove/click events meant for the main map.
 *
 * Stacking: z-index sits below the fullscreen toggle (z:5) and
 * info-card (z:3 ish), so the toggle remains clickable when the
 * cursor enters the bottom-right corner. */
.cfg-preview__loupe {
  position: absolute;
  bottom: 80px;
  right: 20px;
  z-index: 4;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  pointer-events: none;
  background: #d8d6cd;
  opacity: 0;
  transition: opacity 150ms ease;
}

.cfg-preview__loupe.is-active {
  opacity: 1;
}

/* The Mapbox map injected inside the loupe needs to fill the circle —
 * Mapbox's container defaults to 100% width/height but only when its
 * parent has explicit dimensions, which we provide above. */
.cfg-preview__loupe .mapboxgl-map,
.cfg-preview__loupe .mapboxgl-canvas-container,
.cfg-preview__loupe .mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* WMS-mode loupe — same circle wrapper, but content comes from a
 * CSS background-image (the WMS blob URL the main `<img>` is
 * showing), sized larger than the loupe and offset by JS so the
 * cursor's point lands dead-center.  No child elements; JS only
 * twiddles `backgroundImage`, `backgroundSize`, and
 * `backgroundPosition`.
 *
 * `background-color` matches the WMS pane's letterbox color so any
 * out-of-bounds positioning (cursor near image edge) blends in
 * instead of showing a flash of white. */
.cfg-preview__loupe--wms {
  background-color: #2a2a2a;
  background-repeat: no-repeat;
}

/* Crosshair marking the exact point being magnified — sits dead-
 * center over the secondary map.  Small red ring, no fill, so it
 * reads against any base map color without obscuring the imagery. */
.cfg-preview__loupe::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(193, 20, 20, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 2;
}

/* Touch-only devices have no hover state — hide the loupe entirely.
 * Showing a never-triggered widget would just waste pane real
 * estate and confuse the user. */
@media (hover: none) {
  .cfg-preview__loupe {
    display: none;
  }
}

/* Cursor coordinate hint — small dark pill offset down-right from the
 * pointer (never dead-center under it, so it doesn't obscure the exact
 * point being inspected).  `top`/`left` are set in JS, in the SAME pixel
 * space `updatePrintFrame` already uses for the red print box
 * (`map.project()` / event `.point`, both CSS px relative to `.cfg-preview`),
 * so no extra coordinate math is needed here. Opacity-toggled (not
 * hidden/unhidden) so the fade is smooth rather than an abrupt pop. */
.cfg-preview__cursor-coords {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  transform: translate(16px, 16px);
  background: rgba(20, 20, 24, 0.82);
  color: #ffffff;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.cfg-preview__cursor-coords.is-visible {
  opacity: 1;
}

/* Touch-only devices have no hover to drive this — same rationale as the
 * loupe hide rule above. */
@media (hover: none) {
  .cfg-preview__cursor-coords {
    display: none;
  }
}

/* When the preview pane is in browser fullscreen mode, the user
 * agent overrides our flex sizing and paints a default black
 * background — paint our own pane background so the map content
 * stays visually connected to the non-fullscreen state instead of
 * being framed by a black border while tiles load. */
.cfg-preview:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #d8d6cd;
}

/* Safari + older WebKit still need the prefixed pseudo-class.  Keep
 * the rule body identical to `:fullscreen` so the visual outcome is
 * the same regardless of which API path the browser took. */
.cfg-preview:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #d8d6cd;
}

/* Fullscreen is requested on `.cfg-layout` (not `.cfg-preview`) so the
 * frosted options panel stays usable when expanded.  The map is
 * `position:absolute; inset:0` inside the layout, so it fills the screen
 * for free; we only need to paint the pane background. */
.cfg-layout:fullscreen,
.cfg-layout:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #d8d6cd;
}

/* Both .cfg-preview__wms and .cfg-preview__wms-loading set explicit
 * display values (block / inline-flex), which overrides the browser's
 * default [hidden] {display:none} — so toggling the `hidden` attribute
 * from JS would have no effect without this rule. */
.cfg-preview__wms[hidden],
.cfg-preview__wms-loading[hidden],
.cfg-preview__wms-frame[hidden],
.cfg-preview__wms-message[hidden],
.cfg-preview__grid-overlay[hidden] {
  display: none !important;
}

/* Grid overlay canvas — centered over the WMS image's rendered area
 * (same letterbox math the print-frame uses).  JS sets explicit
 * width/height and the canvas drawing buffer accounts for
 * `devicePixelRatio` so 1-px grid lines stay sharp on Retina
 * displays.  Pointer-events disabled so it never blocks the loupe
 * hover or any future click handlers on the underlying image. */
.cfg-preview__grid-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  display: block;
}

/* Print-frame overlay (cf11 "mapbox.gif" analogue, `map.cfm` 1057-1059).
 * Sized by JS as inline width/height % of the WMS preview pane — width
 * tracks the user's printscale so visual feedback is preserved even
 * when the underlying WMS image stays cached. */
.cfg-preview__wms-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px dashed #c11414;
  background: rgba(193, 20, 20, 0.06);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 0 9999px rgba(20, 20, 20, 0.25);
  transition: width 150ms ease, height 150ms ease;
}

/* Edit mode — the print box is highlighted to show it can be grabbed.
   It deliberately stays `pointer-events: none` (inherited from the base
   rule) so scroll-zoom and drag-pan over the box area are NOT blocked;
   the grab is detected by hit-testing map clicks against the box bounds
   in JS instead. */
.cfg-preview__wms-frame.is-editable {
  border-color: #0063a3;
  background: rgba(0, 99, 163, 0.08);
}

/* Grabbed/moveable state — solid highlighted border + move cursor so it
 * visibly reads as draggable.  Corner handles (the small squares) are
 * drawn with layered radial-gradients so no extra DOM nodes are needed. */
.cfg-preview__wms-frame.is-grabbed {
  /* A single blue boundary only — no second (white) outline, which made
     it hard to align the box against map features. */
  border: 2px solid #0063a3;
  background: rgba(0, 99, 163, 0.12);
  /* Let clicks fall through to the map so clicking anywhere recenters
     the box on that point (click-to-place); panning still slides the
     map under the pinned box. */
  pointer-events: none;
}

.cfg-preview__wms-frame.is-grabbed::after {
  content: "";
  position: absolute;
  inset: -5px;
  pointer-events: none;
  background-image:
    radial-gradient(#0063a3 45%, transparent 47%),
    radial-gradient(#0063a3 45%, transparent 47%),
    radial-gradient(#0063a3 45%, transparent 47%),
    radial-gradient(#0063a3 45%, transparent 47%);
  background-repeat: no-repeat;
  background-size: 10px 10px;
  background-position: left top, right top, left bottom, right bottom;
}

.cfg-preview__wms-frame-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: #c11414;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Inline "no coverage" / error message — sits at the top of the
 * preview pane in WMS mode while the upstream's actual response
 * (often a "MyTopo Image Error NNNNN" tile) is still rendered
 * underneath, so the user sees both signals at once.  Colour
 * scheme deliberately matches `.coord-field__error` on the home
 * page (`static/findamap/css/home.css`) for a consistent error
 * vocabulary across the app. */
.cfg-preview__wms-message {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 80%;
  padding: 8px 14px;
  background: #fde2e4;
  color: #8b0000;
  border: 1px solid #f5c2c7;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 3px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cfg-preview__wms-message::before {
  content: "\26A0";
  margin-right: 6px;
  font-size: 12px;
}

.cfg-preview__info {
  position: absolute;
  top: calc(15px + var(--cfg-topbar-h));
  left: calc(15px + var(--cfg-map-offset, 0px));
  z-index: 2;
  transition: top 320ms cubic-bezier(0.4, 0, 0.2, 1),
    left 320ms cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 230px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 28, 30, 0.15);
  border-radius: 4px;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  line-height: 1.5;
  color: #171c1e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Collapse toggle for the Map-details card.  Hidden on desktop (the card is
 * always expanded there); revealed only in the mobile portrait media query,
 * where it shows/hides the info rows via `data-collapsed` on the card. */
.cfg-preview__info-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #353a40;
  font-family: var(--mt-font-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.cfg-preview__info-chevron {
  flex-shrink: 0;
  transition: transform 200ms ease;
}

/* Collapsed → chevron points right and the rows are hidden (rule lives in the
 * portrait media query so the desktop card is never collapsible). */
.cfg-preview__info[data-collapsed="true"] .cfg-preview__info-chevron {
  transform: rotate(-90deg);
}

/* When the options panel is collapsed the launcher pill (`top:16px;
 * left:16px`) occupies the top-left corner where the Map Details card
 * normally sits.  The launcher precedes `.cfg-preview` in the DOM, so a
 * general-sibling selector lets us drop the info card just below the pill
 * (collapsed → `--cfg-map-offset` is 0, so without this they'd overlap). */
.cfg-panel-launcher:not([hidden]) ~ .cfg-preview .cfg-preview__info {
  top: calc(64px + var(--cfg-topbar-h));
  left: 16px;
}

.cfg-preview__info-row {
  display: flex;
  gap: 6px;
  font-weight: 400;
}

.cfg-preview__info-label {
  font-weight: 600;
  color: #353a40;
}

/* Print-Preview CTA: a 220-px-wide button anchored bottom-center of
 * the preview pane.  Wrapped in `.cfg-preview__cta-group` so the
 * group owns the absolute positioning; the CTA itself can stay
 * relatively positioned and act as the anchor for two satellite
 * buttons that fan out radially when the menu opens.  Kept the
 * original (cfg-preview__cta-only) sizing/box-shadow rules so the
 * button looks identical in its idle state. */
.cfg-preview__cta-group {
  position: absolute;
  bottom: 20px;
  /* Centre within the right-side map region (to the right of the panel)
   * rather than the full viewport, matching the offset map centre. */
  left: calc(50% + var(--cfg-map-offset, 0px) / 2);
  transform: translateX(-50%);
  z-index: 2;
  width: 220px;
  transition: left 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cfg-preview__cta {
  position: relative;
  width: 100%;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Three label-states inside a single CTA element.  Toggled by the
 * JS state machine via `data-state` on the button.  Using sibling
 * spans (instead of swapping innerHTML) keeps the button width
 * stable across state changes — width is driven by the widest
 * label ("Rendering…"), so the radial-fan satellites and the CTA
 * stay aligned without the layout jumping mid-animation. */
.cfg-preview__cta-state {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.cfg-preview__cta[data-state="idle"] .cfg-preview__cta-state--idle,
.cfg-preview__cta[data-state="cancel"] .cfg-preview__cta-state--cancel,
.cfg-preview__cta[data-state="processing"]
  .cfg-preview__cta-state--processing {
  display: inline-flex;
}

/* "Cancel" — destructive red so it reads clearly against the
 * default primary blue.  Matches the inline-error palette used
 * elsewhere on this page (see `.cfg-preview__wms-message`
 * variants). */
.cfg-preview__cta[data-state="cancel"] {
  background: #b8262a;
}
.cfg-preview__cta[data-state="cancel"]:hover,
.cfg-preview__cta[data-state="cancel"]:focus-visible {
  background-color: #cc2c30;
}

/* "Processing" — neutral grey.  Cursor stays as a pointer because
 * clicking the button while in this state focuses the active
 * preview popup window (the only sensible action while a render
 * is in flight). */
.cfg-preview__cta[data-state="processing"] {
  background: #5a6772;
  cursor: pointer;
}
.cfg-preview__cta[data-state="processing"]:hover,
.cfg-preview__cta[data-state="processing"]:focus-visible {
  background-color: #69757f;
}

.cfg-preview__cta-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: cfgSpin 800ms linear infinite;
}

/* Satellite buttons — fan out radially from the CTA when the
 * group is in `data-state="menu"`.  Both share absolute placement
 * over the CTA (so collapsed-state they're invisibly stacked
 * underneath it) and animate via `transform` + `opacity`.
 *
 * Animation choice — `cubic-bezier(0.34, 1.56, 0.64, 1)` is a
 * gentle overshoot ("ease-out-back") so the buttons feel like
 * they're springing out of the CTA instead of sliding linearly.
 * The Quick satellite is delayed 60 ms behind Full to give a
 * cascading fan-out feel; on close they reverse with no delay so
 * the menu collapses crisply. */
.cfg-preview__cta-satellite {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  opacity: 0;
  transform: translate(0, 0) scale(0.6);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition:
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 220ms ease-out;
}

.cfg-preview__cta-group[data-state="menu"] .cfg-preview__cta-satellite {
  opacity: 1;
  pointer-events: auto;
}

.cfg-preview__cta-group[data-state="menu"]
  .cfg-preview__cta-satellite--full {
  transform: translate(-75%, -130%) scale(1);
}

.cfg-preview__cta-group[data-state="menu"]
  .cfg-preview__cta-satellite--quick {
  transform: translate(75%, -130%) scale(1);
  transition-delay: 60ms;
}

/* When the group is NOT open the satellites must be unreachable
 * by tab/keyboard too — the JS sets tabindex=-1 in markup, this
 * just belts-and-suspenders the visibility for screen readers
 * and prevents focus-ring leaks during the collapse animation. */
.cfg-preview__cta-group[data-state="idle"] .cfg-preview__cta-satellite,
.cfg-preview__cta-group[data-state="processing"]
  .cfg-preview__cta-satellite {
  visibility: hidden;
  transition:
    transform 240ms ease-in,
    opacity 180ms ease-in,
    visibility 0s linear 240ms;
}

/* ---------------------------------------------------------------------------
 * 5. Responsive — the map stays full-bleed at every breakpoint; only the
 *    floating options panel adapts.  On tablet it narrows; on phones it
 *    becomes a near-full-width sheet (so the map centre is no longer
 *    offset — JS sets `--cfg-map-offset: 0` whenever the panel would leave
 *    too little map showing).  The page stays viewport-locked so the map
 *    keeps the scroll wheel for zoom and the panel scrolls internally.
 * ------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .cfg-panel {
    width: min(924px, 90vw);
  }
}

@media (max-width: 800px) {
  .cfg-topbar {
    padding: 10px 16px;
    gap: 12px;
  }

  .cfg-topbar__left {
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .cfg-topbar__right {
    flex: 0 0 auto;
  }

  /* Breadcrumb current page truncates instead of shoving Share/Cart
   * off-screen once Share was added to the top bar. */
  .cfg-breadcrumbs {
    min-width: 0;
    overflow: hidden;
  }

  .cfg-breadcrumbs__item--current {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(42vw, 180px);
  }

  /* Icon-only Share + Cart (icon + corner badge; label text hidden).
   * Keep the shared 36px height; only trim horizontal padding. */
  .cfg-topbar__share {
    padding: 0 8px;
    margin-right: 4px;
  }

  .cfg-topbar__share span {
    display: none;
  }

  .cfg-cart-link {
    padding: 0 8px;
    gap: 0;
  }

  .cfg-cart-link__label {
    display: none;
  }

  .cfg-panel {
    width: 100%;
  }

  .cfg-left {
    padding: 10px 16px 20px;
  }

  .cfg-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-left: 0;
  }

  .cfg-row__label {
    width: auto;
  }

  .cfg-row__control {
    width: 100%;
  }

  .cfg-row__hint {
    flex: 0 0 auto;
  }

  .cfg-preview__usgs-toggle {
    font-size: 13px;
    height: 32px;
    padding: 0 10px;
  }
}

/* ---------------------------------------------------------------------------
 * 5b. Portrait split workflow (phones AND portrait tablets)
 *
 *    Used instead of the desktop "frosted panel floats over a full-bleed map"
 *    model whenever the options panel would cover MORE THAN HALF the screen —
 *    i.e. the side-by-side split would leave the map with less room than the
 *    panel.  The panel is `min(924px, 60%)` (widened to 90vw / 100% at smaller
 *    widths), so it exceeds 50% of the viewport for every portrait width below
 *    ~1848px (the point where the 924px cap finally equals 50%).  Hence the
 *    `max-width: 1847px` ceiling, which pulls in portrait tablets too:
 *
 *      - PORTRAIT  — vertical split: the interactive map takes the TOP half
 *        and the options panel is docked as a sheet across the BOTTOM half.
 *        Collapsing slides the sheet off the bottom edge and hands the full
 *        height back to the map (the floating launcher pulls it back up).
 *
 *      - LANDSCAPE — desktop-style side-by-side: the options panel is pinned
 *        to the LEFT half and the map fills the right half.  `--cfg-map-offset`
 *        (set by JS to the panel's rendered width) keeps the map centre and
 *        the CSS-centred overlays parked in the right region.  Collapsing
 *        still slides the panel off the left edge (inherited behaviour).
 *
 *    These blocks intentionally come AFTER the `max-width: 800px` rules above
 *    so the orientation-specific overrides win at equal specificity.
 * ------------------------------------------------------------------------- */
@media (orientation: portrait) and (max-width: 1847px) {
  /* The map stays FULL-BLEED behind the nav bar and the bottom sheet (it is
   * NOT pushed below the bar).  This is what restores the frosted-glass look
   * to the top bar / panel / launcher — they blur real map pixels instead of a
   * blank background — and removes the "extra space below the nav bar" that
   * came from the map being inset by the bar height while the controls inside
   * were ALSO offset by it.  So `.cfg-preview` is left at its base `inset: 0`. */

  /* Options panel: frosted bottom sheet floating over the lower half of the
   * map (keeps the base `backdrop-filter` blur, just re-docked to the bottom). */
  .cfg-panel {
    top: auto;
    bottom: 0;
    height: 50%;
    width: 100%;
    padding-top: 0;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(15, 23, 42, 0.18);
  }

  /* Collapsed: slide the sheet DOWN off the bottom edge (not left). */
  .cfg-panel[data-collapsed="true"] {
    transform: translateY(100%);
  }

  /* While the sheet is sliding (class toggled in setPanelCollapsed for the
   * duration of the transform transition) drop the live backdrop blur.  A 20px
   * backdrop-filter is only cheap over STATIC pixels; during open/close the map
   * behind the sheet is simultaneously panning (the camera easeTo) so the blur
   * is re-sampled every frame — that re-sampling is what makes the slide feel
   * jumpy.  The frosted glass is restored the instant motion settles. */
  .cfg-panel.cfg-panel--sliding {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 255, 255, 0.82);
  }

  /* Pin the collapse tab to the sheet's own top edge; rotate its chevron to
   * point DOWN (collapse = dismiss the sheet downward). */
  .cfg-panel__toggle {
    top: 10px;
  }
  .cfg-panel__toggle-icon {
    transform: rotate(-90deg);
  }

  /* Map Options launcher: frosted pill (was opaque white) centred at the very
   * bottom, matching the top bar's frosted-glass surface. */
  .cfg-panel-launcher {
    top: auto;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #171c1e;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.18);
    /* Glide up + fade as the sheet rises (it "becomes" the menu), and settle
     * back into place as the sheet closes. */
    transition:
      transform 320ms cubic-bezier(0.4, 0, 0.2, 1),
      opacity 200ms ease,
      background-color 120ms ease,
      box-shadow 120ms ease;
  }
  body.cfg-panel-open .cfg-panel-launcher {
    transform: translateX(-50%) translateY(-14px);
    opacity: 0;
    pointer-events: none;
  }

  /* Preview CTA: sit just ABOVE the Map Options launcher when the sheet is
   * collapsed (so the two no longer overlap)... */
  .cfg-preview__cta-group {
    bottom: 72px;
    /* Animate the Preview CTA in step with the sheet instead of an abrupt
     * display:none toggle (the instant vanish is what made OPENING feel jumpy;
     * closing only looked fine because the descending sheet masked the pop).
     * Open  → slide DOWN and fade out of view.
     * Close → rise from the bottom back into place. */
    transition:
      transform 320ms cubic-bezier(0.4, 0, 0.2, 1),
      opacity 200ms ease,
      left 320ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.cfg-panel-open .cfg-preview__cta-group {
    transform: translateX(-50%) translateY(180px);
    opacity: 0;
    pointer-events: none;
  }

  /* USGS Quad Grid: top-RIGHT, just below the nav bar, ABOVE the zoom
   * stack (its base `top` already places it below the bar because the
   * map is full-bleed; only the right edge changes). */
  .cfg-preview__usgs-toggle {
    right: 10px;
  }

  /* Default portrait stack (NO USGS pill): same tops as desktop so we
   * don't leave a 50px dead gap when the bridge toggle isn't rendered. */
  .cfg-preview__recenter-btn {
    top: calc(84px + var(--cfg-topbar-h));
  }
  .cfg-preview__edit-toggle {
    top: calc(126px + var(--cfg-topbar-h));
  }
  .cfg-preview__fullscreen-toggle {
    top: calc(168px + var(--cfg-topbar-h));
  }
  .cfg-preview__streetview-toggle {
    top: calc(210px + var(--cfg-topbar-h));
  }

  /* With USGS present: push zoom + the absolute stack down to clear it. */
  .cfg-preview:has(> .cfg-preview__usgs-toggle) .mapboxgl-ctrl-top-right {
    margin-top: calc(50px + var(--cfg-topbar-h));
  }
  .cfg-preview:has(> .cfg-preview__usgs-toggle) .cfg-preview__recenter-btn {
    top: calc(134px + var(--cfg-topbar-h));
  }
  .cfg-preview:has(> .cfg-preview__usgs-toggle) .cfg-preview__edit-toggle {
    top: calc(176px + var(--cfg-topbar-h));
  }
  .cfg-preview:has(> .cfg-preview__usgs-toggle) .cfg-preview__fullscreen-toggle {
    top: calc(218px + var(--cfg-topbar-h));
  }
  .cfg-preview:has(> .cfg-preview__usgs-toggle) .cfg-preview__streetview-toggle {
    top: calc(260px + var(--cfg-topbar-h));
  }

  /* Map-details card: keep it top-left and full size, but reveal its collapse
   * toggle and hide the rows when collapsed.  Override the launcher-sibling
   * push-down (that rule assumes a top-left launcher; here the launcher is at
   * the bottom) so the card stays just below the nav bar. */
  .cfg-panel-launcher:not([hidden]) ~ .cfg-preview .cfg-preview__info {
    top: calc(10px + var(--cfg-topbar-h));
    left: 10px;
  }
  .cfg-preview__info-toggle {
    display: flex;
  }
  .cfg-preview__info:not([data-collapsed="true"]) .cfg-preview__info-toggle {
    margin-bottom: 6px;
  }
  .cfg-preview__info[data-collapsed="true"] .cfg-preview__info-row {
    display: none;
  }

  /* ------------------------------------------------------------------ *
   * Edit (move-the-print-box) mode.  `body.cfg-is-editing` is toggled by
   * enter/exitEditMode in configure_map.js.  While editing we clear the
   * bottom of the screen of the regular workflow controls — the Map
   * Options launcher and the Preview CTA — and dock the Revert/Save bar
   * (with its hint text) to the bottom edge as a frosted bar, so the user
   * focuses solely on placing the print box.
   * ------------------------------------------------------------------ */
  body.cfg-is-editing .cfg-panel-launcher,
  body.cfg-is-editing .cfg-preview__cta-group {
    display: none !important;
  }

  body.cfg-is-editing .cfg-preview__edit-bar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: none;
    /* Frosted glass to match the top bar / options sheet / launcher. */
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    border-top: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  /* Hint text takes the full first row; the action buttons share the next. */
  body.cfg-is-editing .cfg-preview__edit-hint {
    flex: 1 1 100%;
    max-width: none;
  }

  /* Equal-width, comfortably tappable Revert / Save buttons. */
  body.cfg-is-editing .cfg-preview__edit-btn {
    flex: 1 1 0;
    height: 40px;
    font-size: 14px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  /* Panel pinned to the left half; the map (full-bleed underneath) shows in
   * the right half.  Cap the width so very wide landscape phones don't give
   * the panel more than it needs. */
  .cfg-panel {
    width: 50%;
    max-width: 460px;
  }

  /* Narrow left panel — stack each row's label above its control (mirrors the
   * <=800px treatment, repeated here for landscape phones wider than 800px). */
  .cfg-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-left: 0;
  }
  .cfg-row__label {
    width: auto;
  }
  .cfg-row__control {
    width: 100%;
  }
  /* THE fix for the "huge space between fields": the base hint is `flex: 0 1
   * 238px`, which is a 238px-WIDE column in the horizontal row, but once the
   * row stacks (flex-direction: column) that 238px becomes the hint's HEIGHT —
   * leaving a tall empty block under rows like Coordinates / Title.  Reset to
   * auto height (mirrors the <=800px block, which is why iPhone SE was fine). */
  .cfg-row__hint {
    flex: 0 0 auto;
  }

  /* The base form uses a generous 30px inter-row gap (+20px vertical padding)
   * which, in the short landscape panel with each row now STACKED (label over
   * control), leaves big gaps between fields.  Tighten both for landscape. */
  .cfg-form {
    gap: 14px;
    padding: 12px 0;
  }
}

/* ==========================================================================
 * Cart / contact-information modal
 * Mirrors Angular CustomMapDialogComponent's fourth step (name/email/phone)
 * ========================================================================== */

.cfg-modal {
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  color: #171c1e;
  background: #ffffff;
}

.cfg-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.cfg-modal__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Header */
.cfg-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e3e5e6;
}

.cfg-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #171c1e;
}

.cfg-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #52595c;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}
.cfg-modal__close:hover {
  background: #f2f4f5;
  color: #171c1e;
}

/* Body */
.cfg-modal__body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cfg-modal__info {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #52595c;
}

/* Fields */
.cfg-modal__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cfg-modal__label {
  font-size: 13px;
  font-weight: 500;
  color: #2e3638;
}

.cfg-modal__required {
  color: #c0180c;
}

.cfg-modal__input {
  height: 38px;
  border: 1px solid #b0b8bb;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  color: #171c1e;
  background: #ffffff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.cfg-modal__input::placeholder {
  color: #8c9599;
}
.cfg-modal__input:focus {
  border-color: #006ca2;
  box-shadow: 0 0 0 3px rgba(0, 108, 162, 0.18);
}
.cfg-modal__input--error {
  border-color: #c0180c;
  box-shadow: 0 0 0 3px rgba(192, 24, 12, 0.14);
}

.cfg-modal__field-error {
  font-size: 12px;
  color: #c0180c;
  min-height: 16px;
}

/* Submit error banner */
.cfg-modal__submit-error {
  background: #fdf0ee;
  border: 1px solid #f8c9c4;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #8b2017;
}

/* Cumulative price breakdown (component-cart flow). */
.cfg-modal__price {
  border: 1px solid #dce0e2;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7f9fa;
  font-size: 13px;
}

.cfg-modal__price-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cfg-modal__price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #48545c;
}

.cfg-modal__price-line span:last-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cfg-modal__price-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dce0e2;
  font-weight: 600;
  color: #1f2a30;
}

.cfg-modal__price-total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Spinner inside button */
.cfg-modal__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: cfg-modal-spin 0.65s linear infinite;
  vertical-align: middle;
}
/* `display: inline-block` above overrides the browser default `[hidden]`
 * rule — this guard restores the expected behaviour. */
.cfg-modal__spinner[hidden] {
  display: none;
}
@keyframes cfg-modal-spin {
  to { transform: rotate(360deg); }
}

/* Preview-status badge inside the modal */
.cfg-modal__preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  background: #f2f4f5;
  border: 1px solid #dce0e2;
  color: #52595c;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}
.cfg-modal__preview[hidden] {
  display: none;
}
.cfg-modal__preview--generating {
  background: #f0f6ff;
  border-color: #b8d4f0;
  color: #1a5ca8;
}
.cfg-modal__preview--ready {
  background: #edf8f1;
  border-color: #a8d9b8;
  color: #1a6b3a;
}
.cfg-modal__preview--failed {
  background: #fdf6e3;
  border-color: #f0d880;
  color: #7a5c00;
}
.cfg-modal__preview-spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(26, 92, 168, 0.25);
  border-top-color: #1a5ca8;
  border-radius: 50%;
  animation: cfg-modal-spin 0.65s linear infinite;
}
.cfg-modal__preview-spinner[hidden] {
  display: none;
}
.cfg-modal__preview-icon {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}
.cfg-modal__preview-text {
  flex: 1;
  min-width: 0;
}

/* Rendered preview image inside the cart modal */
.cfg-modal__preview-img-wrap {
  border-radius: 8px;
  overflow: hidden;
  background: #d8d6cd;
  border: 1px solid #dce0e2;
  /* Center the image and give it a consistent shadow */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.cfg-modal__preview-img-wrap[hidden] {
  display: none;
}
.cfg-modal__preview-img {
  display: block;
  width: 100%;
  height: auto;
  /* Portrait maps are naturally taller; cap height so the modal
   * doesn't overflow the viewport. */
  max-height: 340px;
  object-fit: contain;
  cursor: zoom-in;
  transition: opacity 250ms ease;
}
/* Landscape orientation — wider aspect, slightly shorter cap */
.cfg-modal__preview-img[data-orientation="L"] {
  max-height: 260px;
}
/* Portrait orientation — taller, use the full cap */
.cfg-modal__preview-img[data-orientation="P"] {
  max-height: 340px;
}

/* Footer */
.cfg-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #e3e5e6;
}

.cfg-modal__btn-text {
  vertical-align: middle;
}

.cfg-modal__btn-icon {
  margin-left: 6px;
  vertical-align: middle;
}

/* Disabled Purchase Map button — matches the overall muted disabled style */
.cfg-btn--primary:disabled,
.cfg-btn--primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
 * No-preview confirmation dialog
 * ========================================================================== */
.cfg-confirm-dialog {
  border: none;
  border-radius: 10px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.22);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
  color: #171c1e;
  background: #ffffff;
}
.cfg-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}
.cfg-confirm-dialog__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cfg-confirm-dialog__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 18px 20px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #7a5c00;
  border-bottom: 1px solid #f0e8cc;
  background: #fffbee;
  border-radius: 10px 10px 0 0;
}
.cfg-confirm-dialog__body {
  margin: 0;
  padding: 16px 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #52595c;
}
.cfg-confirm-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid #e3e5e6;
}

/* Neutral (non-warning) title variant -- used by the Share dialog, which
 * isn't cautioning the user about anything, unlike the discard-edit /
 * no-preview dialogs this component was originally built for. */
.cfg-confirm-dialog__title--neutral {
  color: #0f172a;
  background: #f4f6f8;
  border-bottom-color: #e3e5e6;
}

/* Share dialog: the link input + Copy button sit directly under the body
 * copy, ABOVE the footer's single "Close" button -- so Copy is reachable
 * without the footer's usual two-button confirm/cancel framing. */
.cfg-share-dialog__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 16px;
}

.cfg-share-dialog__input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d7dadc;
  border-radius: 6px;
  font-size: 13px;
  color: #171c1e;
  background: #f8f9fa;
}

.cfg-share-dialog__input:focus {
  outline: 2px solid #0063a3;
  outline-offset: 1px;
}

.cfg-share-dialog__row .cfg-btn {
  height: 34px;
  font-size: 13px;
  padding: 0 14px;
  flex-shrink: 0;
}

/* Momentary "Copied" state -- `_flashCopied` swaps the label/icon in and
 * back out again; the green tint (vs. the button's normal blue) is the
 * confirmation cue, on top of the checkmark icon itself. */
.cfg-share-dialog__row .cfg-btn:has(svg + span) {
  background: #1a8f5e;
}

.cfg-share-dialog__row .cfg-btn:has(svg + span):hover {
  background: #17804f;
}

.cfg-share-dialog__error {
  margin: 0;
  padding: 0 20px 12px;
  font-size: 12.5px;
  color: #c0180c;
}

/* Override the full-height 16px main-bar button size for the dialog. */
.cfg-confirm-dialog__footer .cfg-btn {
  height: 34px;
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .cfg-confirm-dialog__footer {
    flex-direction: column-reverse;
    gap: 6px;
  }
  .cfg-confirm-dialog__footer .cfg-btn {
    width: 100%;
    justify-content: center;
  }

  .cfg-share-dialog__row {
    flex-direction: column;
    align-items: stretch;
  }

  .cfg-share-dialog__row .cfg-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 540px) {
  .cfg-modal {
    border-radius: 12px 12px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  .cfg-modal__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .cfg-modal__footer .cfg-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------------
 * 6. Interactive edit-mode tour (Driver.js) — theme overrides + the extra
 *    pieces Driver.js doesn't provide out of the box: a fake animated
 *    cursor that demos clicks/drags, an arrow-key badge cluster for the
 *    keyboard-nudge demo, and a pulsing highlight for edit-hint text.
 *    Wired in section 19 of configure_map.js. Driver.js's own CSS (loaded
 *    as `vendor/driver.css`) already restricts pointer events to only the
 *    spotlighted element + the popover while a tour is active — nothing
 *    here needs to re-implement that "block everything else" behaviour.
 * ------------------------------------------------------------------------- */
/* Driver.js forces `pointer-events: auto` on whatever it's currently
 * highlighting and `pointer-events: none` on everything else (see
 * driver.css's `.driver-active *` / `.driver-active-element` rules) —
 * which directly fights this app's own edit-mode click plumbing (section
 * 13a) during the "grab the box" / "move it" tour steps:
 *
 *   1. The live map (and its Mapbox canvas) must keep receiving REAL
 *      mousemove/click events for the whole tour — grabbing the box,
 *      clicking/dragging to move it, and the app's own pointer/crosshair
 *      cursor logic (`onEditModeHover` / `grabBox`) all depend on Mapbox
 *      actually seeing them. The canvas is a SIBLING of `#cfg-wms-frame`
 *      (not a descendant), so Driver.js's own "active element" exception
 *      never reaches it once the box (not the map) is the highlighted
 *      target — it gets locked to `pointer-events: none` and every event
 *      is silently dropped. Force it back on, unconditionally, whenever a
 *      tour is running.
 *   2. `#cfg-wms-frame` (the print box) is deliberately click-transparent
 *      (see its own `pointer-events: none` below) so a click "on the box"
 *      falls through to that same map canvas, which hit-tests it against
 *      the box's bounds to decide whether to grab it. Driver.js flags it
 *      `.driver-active-element` during that step and forces `auto` on it
 *      — exactly backwards here, since that makes the div itself absorb
 *      the click instead of letting it pass through, so the grab never
 *      fires. Keep it click-transparent regardless of Driver.js's own
 *      rule (both overrides are more specific than driver.css's, but
 *      `!important` guarantees it regardless of load order / future
 *      driver.css changes). */
.driver-active #cfg-map,
.driver-active #cfg-map * {
  pointer-events: auto !important;
}

.driver-active .driver-active-element#cfg-wms-frame,
.driver-active .driver-active-element#cfg-wms-frame * {
  pointer-events: none !important;
}

.driver-popover {
  max-width: 320px;
  padding: 18px;
  border-radius: 14px;
  font-family: var(--mt-font-primary);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.3);
}

.driver-popover-title {
  font: 700 16px/1.3 var(--mt-font-primary);
  color: #0f172a;
  padding-right: 22px;
}

.driver-popover-description {
  font: 400 13.5px/1.5 var(--mt-font-primary);
  color: #3c4247;
  margin-top: 6px;
}

.driver-popover-close-btn {
  width: 28px;
  height: 28px;
  font-size: 20px;
  color: #9aa0a6;
}

.driver-popover-close-btn:hover,
.driver-popover-close-btn:focus {
  color: #171c1e;
}

.driver-popover-footer {
  margin-top: 16px;
}

.driver-popover-progress-text {
  font: 500 12px/1 var(--mt-font-primary);
  color: #6a6e79;
}

.driver-popover-footer button {
  padding: 7px 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  font: 600 12.5px/1 var(--mt-font-primary);
  background: #f1f1f6;
  color: #171c1e;
  text-shadow: none;
}

.driver-popover-footer button:hover,
.driver-popover-footer button:focus {
  background: #e6e7ee;
}

.driver-popover-footer .driver-popover-next-btn {
  background: #0063a3;
  color: #fff;
  border-color: transparent;
}

.driver-popover-footer .driver-popover-next-btn:hover,
.driver-popover-footer .driver-popover-next-btn:focus {
  background: #0c77be;
}

/* "Do it yourself" steps (Next/Previous hidden — only Close shown, see the
 * `action: true` steps in configure_map.js) get a small accent bar + tint
 * so it's visually obvious this step is waiting on a real interaction, not
 * a click on Next. */
.cfg-tour-popover--action {
  border-left: 4px solid #0063a3;
}

.cfg-tour-popover--action .driver-popover-title::before {
  content: "👉 ";
}

/* Fake cursor — glides between demo points and pulses a "click" ripple.
 * `position: fixed` + a transformed offset (set from JS via
 * `translate(x, y)`) keeps it in viewport coordinates so it can travel
 * over the map, the topbar, or any control regardless of scroll/layout. */
.cfg-tour-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  margin: -6px 0 0 -4px;
  pointer-events: none;
  z-index: 1000000001;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  opacity: 0;
  transition: opacity 150ms ease;
}

.cfg-tour-cursor.is-visible {
  opacity: 1;
}

/* The outer `.cfg-tour-cursor` div's `transform: translate()` (set from JS)
 * handles POSITION; the glyph wrapper's own `transform` below layers
 * press/idle effects on top without fighting that positioning transform.
 * `.cfg-tour-cursor__glyph` (a `<span>` whose `innerHTML` is swapped by
 * `_setCursorMode` between the pointer/hand/crosshair SVGs, see
 * configure_map.js section 19) needs `display: inline-block` for its own
 * `transform` to actually apply. */
.cfg-tour-cursor__glyph {
  display: inline-block;
  transition: transform 140ms ease-out;
}

/* Quick "press" the instant a click pulse fires — paired with the ring
 * ripple below, two layered cues read much more like an actual click. */
.cfg-tour-cursor.is-pressing .cfg-tour-cursor__glyph {
  transform: scale(0.8);
  transition: transform 90ms ease-out;
}

/* Gentle bob while the cursor is resting on a target between clicks, so
 * a paused demo doesn't look like a frozen screenshot. */
.cfg-tour-cursor.is-idle .cfg-tour-cursor__glyph {
  animation: cfg-tour-cursor-bob 1.6s ease-in-out infinite;
}

@keyframes cfg-tour-cursor-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.cfg-tour-cursor__ripple {
  position: absolute;
  top: 6px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 99, 163, 0.35);
  border: 2px solid rgba(0, 99, 163, 0.7);
  transform: scale(0.3);
  opacity: 0;
}

.cfg-tour-cursor__ripple.is-active {
  animation: cfg-tour-ripple 550ms ease-out;
}

@keyframes cfg-tour-ripple {
  0% {
    transform: scale(0.3);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* While demoing "drag the map", the ripple stays visibly "held down"
 * instead of pulsing once, so the glide reads as a press-and-drag rather
 * than a series of clicks. */
.cfg-tour-cursor.is-dragging .cfg-tour-cursor__ripple {
  opacity: 0.55;
  transform: scale(1.1);
  animation: none;
  transition: transform 200ms ease, opacity 200ms ease;
}

/* "Move it" target box — a dashed outline, sized to match the real print
 * frame (`_sizeTargetToBox`, configure_map.js section 19), that marks
 * where the "move it" steps (5-7) want the box dragged/clicked/nudged
 * to. Positioned via a `translate()` transform kept in sync with a
 * GEOGRAPHIC point (not a screen pixel) on every map `move` — see
 * `_showMoveTarget` — so it stays correctly placed through a click-ease,
 * a manual drag-pan, or arrow-key panning alike. Sits one z-index below
 * the fake cursor so the cursor draws on top of it.
 *
 * `position: absolute` (NOT `fixed`) — this is now appended as a child of
 * `.cfg-preview`, the SAME `overflow: hidden` container `#cfg-wms-frame`
 * itself lives in, using `map.project()`'s container-relative pixels
 * (rather than `document.body` + viewport-relative coordinates). A very
 * zoomed-out print box can project to a footprint bigger than the visible
 * map pane; anchoring here means it gets clipped at the map's own edges
 * exactly like the real box already is, instead of rendering (as a fixed
 * body child) right over the tour popover / top bar. */
.cfg-tour-target {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  border: 2.5px dashed #0c77be;
  border-radius: 4px;
  background: rgba(12, 119, 190, 0.14);
  pointer-events: none;
  z-index: 1000000000;
}

.cfg-tour-target::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 7px;
  animation: cfg-tour-target-pulse 1.4s ease-in-out infinite;
}

@keyframes cfg-tour-target-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(12, 119, 190, 0.35);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(12, 119, 190, 0.16);
  }
}

/* Arrow-key nudge demo — a small 3x2 badge cluster (↑ over ← ↓ →) that
 * pulses one direction at a time. */
.cfg-tour-keys {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000000001;
  pointer-events: none;
}

.cfg-tour-keys__row {
  display: flex;
  gap: 3px;
}

.cfg-tour-keys__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  transition: background 150ms ease, transform 150ms ease;
}

.cfg-tour-keys__key.is-active {
  background: #0c77be;
  transform: scale(1.15);
}

/* Word-level highlight for the specific phrase in the edit-mode hint text
 * the tour calls out ("... select it for moving") — injected as a `<mark>`
 * by `_highlightHintPhrase` in configure_map.js. Cleared for free the next
 * time the real app updates the hint (grab/release), which overwrites the
 * whole `textContent`. */
.cfg-tour-mark {
  background: #fff2a8;
  color: #171c1e;
  padding: 0 2px;
  border-radius: 3px;
  animation: cfg-tour-mark-pulse 1.1s ease-in-out infinite;
}

@keyframes cfg-tour-mark-pulse {
  0%,
  100% {
    background: #fff2a8;
  }
  50% {
    background: #ffe066;
  }
}

/* Whole-element pulse for the edit-hint box once its text has changed
 * (the "message updated" step) — a softer glow rather than a colour
 * swap, since the text itself no longer needs a specific phrase called
 * out. */
.cfg-tour-hint-pulse {
  animation: cfg-tour-hint-glow 1.2s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes cfg-tour-hint-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 99, 163, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 99, 163, 0.25);
  }
}
