/**
 * Nexus Foundry WordPress widget chrome.
 * Prefixed selectors only. Do not target html/body/button/p/a globally.
 */

.nxf-root {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.nxf-root .nxf-shell,
:host .nxf-shell {
  display: flex;
  flex-direction: column;
  gap: var(--nxf-space-3);
  padding: var(--nxf-space-4);
  border: 1px solid var(--nxf-color-border);
  border-radius: var(--nxf-radius);
  background: var(--nxf-color-surface);
  box-shadow: var(--nxf-shadow);
}

.nxf-root .nxf-title,
:host .nxf-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.nxf-root .nxf-lede,
:host .nxf-lede {
  margin: 0;
  color: var(--nxf-color-fg-muted);
  font-size: 0.92rem;
}

.nxf-root .nxf-capability,
:host .nxf-capability {
  margin: 0;
  font-size: 0.82rem;
  color: var(--nxf-color-fg-muted);
}

.nxf-root .nxf-capability[data-nxf-state="UNAVAILABLE"],
.nxf-root .nxf-capability[data-nxf-state="ENV_GATED"],
.nxf-root .nxf-capability[data-nxf-state="WITHHELD"],
.nxf-root .nxf-capability[data-nxf-state="FIXTURE"],
:host .nxf-capability[data-nxf-state="UNAVAILABLE"] {
  color: var(--nxf-color-danger);
}

.nxf-root .nxf-btn,
:host .nxf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--nxf-touch);
  min-width: var(--nxf-touch);
  padding: var(--nxf-space-2) var(--nxf-space-4);
  border: 1px solid var(--nxf-color-accent);
  border-radius: var(--nxf-radius);
  background: var(--nxf-color-accent);
  color: var(--nxf-color-accent-fg);
  font: inherit;
  cursor: pointer;
}

.nxf-root .nxf-btn:focus-visible,
:host .nxf-btn:focus-visible,
.nxf-root .nxf-input:focus-visible,
:host .nxf-input:focus-visible {
  outline: 3px solid var(--nxf-color-focus);
  outline-offset: 2px;
}

.nxf-root .nxf-btn:disabled,
:host .nxf-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nxf-root .nxf-btn--secondary,
:host .nxf-btn--secondary {
  background: var(--nxf-color-surface);
  color: var(--nxf-color-accent);
}

.nxf-root .nxf-composer,
:host .nxf-composer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nxf-space-2);
  align-items: flex-end;
}

.nxf-root .nxf-field,
:host .nxf-field {
  display: flex;
  flex-direction: column;
  gap: var(--nxf-space-1);
  flex: 1 1 12rem;
  min-width: 0;
}

.nxf-root .nxf-input,
:host .nxf-input {
  width: 100%;
  min-height: var(--nxf-touch);
  padding: var(--nxf-space-2);
  border: 1px solid var(--nxf-color-border);
  border-radius: var(--nxf-radius);
  background: var(--nxf-color-surface);
  color: var(--nxf-color-fg);
  font: inherit;
}

.nxf-root .nxf-history,
:host .nxf-history {
  display: flex;
  flex-direction: column;
  gap: var(--nxf-space-2);
  max-height: 22rem;
  overflow: auto;
}

.nxf-root .nxf-msg,
:host .nxf-msg {
  padding: var(--nxf-space-3);
  border-radius: var(--nxf-radius);
  background: var(--nxf-color-bg);
}

.nxf-root .nxf-iframe,
.nxf-root .nxf-frame,
:host .nxf-iframe,
:host .nxf-frame {
  display: block;
  width: 100%;
  min-height: var(--nxf-iframe-min-height);
  max-height: var(--nxf-iframe-max-height);
  border: 0;
  border-radius: var(--nxf-radius);
  background: var(--nxf-color-bg);
}

.nxf-root .nxf-alt,
:host .nxf-alt {
  display: flex;
  flex-direction: column;
  gap: var(--nxf-space-2);
}

.nxf-root .nxf-table,
:host .nxf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.nxf-root .nxf-th,
.nxf-root .nxf-td,
:host .nxf-th,
:host .nxf-td {
  text-align: left;
  padding: var(--nxf-space-2);
  border-bottom: 1px solid var(--nxf-color-border);
}

.nxf-root .nxf-actions,
:host .nxf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nxf-space-2);
}

.nxf-embed-body {
  margin: 0;
  min-height: 100%;
  background: var(--nxf-color-bg);
}

.nxf-embed-body #nxf-embed-root {
  min-height: 240px;
}

@media (max-width: 40rem) {
  .nxf-root .nxf-composer,
  :host .nxf-composer {
    flex-direction: column;
    align-items: stretch;
  }

  .nxf-root .nxf-btn,
  :host .nxf-btn {
    width: 100%;
  }
}

/* Nexus Standards participation (src/Standards/Participation.php) */
.nxf-standards .nxf-hp{position:absolute!important;left:-10000px!important;width:1px;height:1px;overflow:hidden}
.nxf-standards .nxf-table{width:100%;border-collapse:collapse}
.nxf-standards .nxf-table th,.nxf-standards .nxf-table td{text-align:left;padding:.4em .5em;border-bottom:1px solid var(--nxf-color-border)}
.nxf-standards .nxf-list{list-style:none;padding:0}
.nxf-standards .nxf-list li{padding:.5em 0;border-bottom:1px solid var(--nxf-color-border)}
.nxf-standards .nxf-field{margin:.6em 0}
.nxf-standards .nxf-field label{display:block;font-weight:600}
.nxf-standards input[type=text],.nxf-standards input[type=email],.nxf-standards select,.nxf-standards textarea{width:100%;max-width:40rem}
.nxf-standards input[type=checkbox]+*{font-weight:400}
.nxf-standards .nxf-status:empty{display:none}

/* ------------------------------------------------------------------ hosted portal map */
/* Painted only inside the Foundry embed page for kind map|view. Kit: mono eyebrows
   11px/500/0.16em, weight 500 titles, 5px/4px radii, hairline structure, no washes,
   no glows. Reserved rows: bar top (status left, tools right), layers panel under
   the bar on the left, readout top-right, attribution bottom-left, MapLibre
   navigation stack bottom-right. Nothing overlaps. */

.nxf-embed-body--globe {
  background: var(--nxf-globe-canvas);
}

.nxf-embed-body--globe #nxf-embed-root {
  min-height: 100vh;
}

.nxf-root .nxf-portal {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  min-height: 420px;
  overflow: hidden;
  background: var(--nxf-globe-canvas);
  color: var(--nxf-globe-text);
  font-family: var(--nxf-globe-font-sans);
  font-size: 13px;
  line-height: 1.45;
}

.nxf-root .nxf-portal--fullscreen {
  height: 100%;
}

.nxf-root .nxf-portal__canvas {
  position: absolute;
  inset: 0;
  background: var(--nxf-globe-canvas);
  outline: none;
}

.nxf-root .nxf-portal__canvas:focus-visible {
  box-shadow: inset 0 0 0 2px var(--nxf-globe-focus);
}

.nxf-root .nxf-portal__canvas .maplibregl-canvas {
  outline: none;
}

.nxf-root .nxf-portal__canvas .maplibregl-canvas:focus-visible {
  outline: 2px solid var(--nxf-globe-focus);
  outline-offset: -2px;
}

/* ---- top bar */

.nxf-root .nxf-portal__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nxf-space-3);
  min-height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--nxf-globe-hairline);
  background: var(--nxf-globe-surface);
}

.nxf-root .nxf-portal__status {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  gap: 2px var(--nxf-space-3);
  min-width: 0;
  overflow: hidden;
}

.nxf-root .nxf-portal__eyebrow {
  margin: 0;
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nxf-globe-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nxf-root .nxf-portal__eyebrow[data-nxf-basemap="OUTLINE"] {
  color: var(--nxf-globe-text);
}

.nxf-root .nxf-portal__title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--nxf-globe-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nxf-root .nxf-portal__title:empty {
  display: none;
}

.nxf-root .nxf-portal__tools {
  display: flex;
  align-items: center;
  gap: var(--nxf-space-2);
  flex: 0 0 auto;
}

/* ---- segmented control (GLOBE | MAP): 5px frame, active segment inverted */

.nxf-root .nxf-portal__segment {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-radius: var(--nxf-globe-radius);
  background: transparent;
}

.nxf-root .nxf-portal__segment-btn {
  appearance: none;
  min-width: 56px;
  height: 28px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--nxf-globe-radius-chip);
  background: transparent;
  font: inherit;
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nxf-globe-text-muted);
  cursor: pointer;
  transition: background-color var(--nxf-globe-motion-fast) var(--nxf-globe-ease), color var(--nxf-globe-motion-fast) var(--nxf-globe-ease);
}

.nxf-root .nxf-portal__segment-btn:hover {
  color: var(--nxf-globe-text);
  background: var(--nxf-globe-bg-hover);
}

.nxf-root .nxf-portal__segment-btn[aria-checked="true"] {
  color: var(--nxf-globe-primary-ink);
  background: var(--nxf-globe-primary-bg);
}

.nxf-root .nxf-portal__segment-btn:focus-visible,
.nxf-root .nxf-portal__tool:focus-visible,
.nxf-root .nxf-portal__check:focus-visible {
  outline: 2px solid var(--nxf-globe-focus);
  outline-offset: 2px;
}

/* ---- tool buttons (36px, 5px, hairline; active = hairline-strong + text-primary) */

.nxf-root .nxf-portal__tool {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--nxf-globe-hairline);
  border-radius: var(--nxf-globe-radius);
  background: transparent;
  font: inherit;
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nxf-globe-text-muted);
  cursor: pointer;
  transition: border-color var(--nxf-globe-motion-fast) var(--nxf-globe-ease), color var(--nxf-globe-motion-fast) var(--nxf-globe-ease);
}

.nxf-root .nxf-portal__tool:hover {
  color: var(--nxf-globe-text);
  border-color: var(--nxf-globe-hairline-strong);
}

.nxf-root .nxf-portal__tool[aria-expanded="true"],
.nxf-root .nxf-portal__tool[aria-pressed="true"] {
  color: var(--nxf-globe-text);
  border-color: var(--nxf-globe-hairline-strong);
}

.nxf-root .nxf-portal__tool--icon {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.nxf-root .nxf-portal__tool svg {
  flex: 0 0 auto;
}

/* ---- layers panel */

.nxf-root .nxf-portal__panel {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 3;
  width: min(300px, calc(100% - 24px));
  max-height: calc(100% - 104px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-radius: var(--nxf-globe-radius);
  background: var(--nxf-globe-surface);
  overflow: hidden;
}

.nxf-root .nxf-portal__panel[hidden] {
  display: none;
}

.nxf-root .nxf-portal__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nxf-space-2);
  padding: 6px 6px 6px 12px;
  border-bottom: 1px solid var(--nxf-globe-hairline);
}

.nxf-root .nxf-portal__layers {
  flex: 1 1 auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  overflow: auto;
}

.nxf-root .nxf-portal__layer {
  padding: 8px 12px;
  border-bottom: 1px solid var(--nxf-globe-hairline);
}

.nxf-root .nxf-portal__layer:last-child {
  border-bottom: 0;
}

.nxf-root .nxf-portal__layer--empty {
  font-family: var(--nxf-globe-font-mono);
  font-size: 12px;
  color: var(--nxf-globe-text-muted);
}

.nxf-root .nxf-portal__layer-head {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  align-items: start;
}

.nxf-root .nxf-portal__check {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-radius: var(--nxf-globe-radius-chip);
  background: transparent;
  cursor: pointer;
  position: relative;
}

.nxf-root .nxf-portal__check:checked {
  border-color: var(--nxf-globe-primary-bg);
  background: var(--nxf-globe-primary-bg);
}

.nxf-root .nxf-portal__check:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--nxf-globe-primary-ink);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.nxf-root .nxf-portal__check--fixed {
  border-style: dashed;
  cursor: default;
}

.nxf-root .nxf-portal__layer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}

.nxf-root .nxf-portal__layer-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--nxf-globe-text);
}

.nxf-root .nxf-portal__layer-meta {
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  color: var(--nxf-globe-text-muted);
  overflow-wrap: anywhere;
}

.nxf-root .nxf-portal__layer--off .nxf-portal__layer-title {
  color: var(--nxf-globe-text-muted);
}

.nxf-root .nxf-portal__layer--off .nxf-portal__legend {
  display: none;
}

.nxf-root .nxf-portal__legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 0 26px;
  padding: 0;
  list-style: none;
}

.nxf-root .nxf-portal__legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  color: var(--nxf-globe-text);
}

.nxf-root .nxf-portal__legend-row[data-nxf-legend="nodata"] {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--nxf-globe-hairline);
  color: var(--nxf-globe-text-muted);
}

.nxf-root .nxf-portal__dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nxf-dot, currentColor);
}

/* ---- readout */

.nxf-root .nxf-portal__readout {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 2;
  min-width: 200px;
  max-width: min(280px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-radius: var(--nxf-globe-radius);
  background: var(--nxf-globe-surface);
  pointer-events: none;
}

.nxf-root .nxf-portal__facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 6px 0 0;
}

.nxf-root .nxf-portal__fact-term {
  margin: 0;
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--nxf-globe-text-muted);
}

.nxf-root .nxf-portal__fact-value {
  margin: 0;
  font-family: var(--nxf-globe-font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--nxf-globe-text);
  overflow-wrap: anywhere;
}

/* ---- attribution and notice */

.nxf-root .nxf-portal__attribution {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  max-width: calc(100% - 120px);
  margin: 0;
  padding: 2px 6px;
  border: 1px solid var(--nxf-globe-hairline);
  border-radius: var(--nxf-globe-radius-chip);
  background: var(--nxf-globe-surface);
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  color: var(--nxf-globe-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.nxf-root .nxf-portal--panel-open .nxf-portal__attribution,
.nxf-root .nxf-portal--panel-open .maplibregl-ctrl-bottom-left {
  left: 324px;
}

.nxf-root .nxf-portal__notice {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 4;
  max-width: min(360px, calc(100% - 24px));
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-left: 2px solid var(--nxf-globe-alert);
  border-radius: var(--nxf-globe-radius);
  background: var(--nxf-globe-surface);
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  color: var(--nxf-globe-text);
}

.nxf-root .nxf-portal__notice[hidden] {
  display: none;
}

/* ---- MapLibre navigation and scale, restyled to the kit (36px, 5px, hairline) */

.nxf-root .nxf-portal .maplibregl-ctrl-bottom-right {
  bottom: 12px;
  right: 12px;
}

.nxf-root .nxf-portal .maplibregl-ctrl-bottom-left {
  bottom: 40px;
  left: 12px;
}

.nxf-root .nxf-portal .maplibregl-ctrl-group {
  margin: 0;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-radius: var(--nxf-globe-radius);
  background: var(--nxf-globe-surface);
  box-shadow: none;
}

.nxf-root .nxf-portal .maplibregl-ctrl-group button {
  width: 36px;
  height: 36px;
  border-radius: 0;
  background-color: transparent;
}

.nxf-root .nxf-portal .maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--nxf-globe-hairline);
}

.nxf-root .nxf-portal .maplibregl-ctrl-group button:hover {
  background-color: var(--nxf-globe-bg-hover);
}

.nxf-root .nxf-portal .maplibregl-ctrl-group button:focus-visible {
  outline: 2px solid var(--nxf-globe-focus);
  outline-offset: -2px;
  box-shadow: none;
}

.nxf-root .nxf-portal .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1);
}

.nxf-root .nxf-portal .maplibregl-ctrl-scale {
  margin: 0;
  padding: 0 6px;
  border: 1px solid var(--nxf-globe-hairline-strong);
  border-top: 0;
  border-radius: 0 0 var(--nxf-globe-radius-chip) var(--nxf-globe-radius-chip);
  background: var(--nxf-globe-surface);
  font-family: var(--nxf-globe-font-mono);
  font-size: 11px;
  color: var(--nxf-globe-text-muted);
}

/* ---- phone layout: panel becomes a sheet, readout drops under the bar */

@media (max-width: 40rem) {
  .nxf-root .nxf-portal__bar {
    gap: 8px;
    padding: 4px 8px;
  }

  .nxf-root .nxf-portal__title {
    display: none;
  }

  .nxf-root .nxf-portal__tools {
    gap: 6px;
  }

  .nxf-root .nxf-portal__segment-btn {
    min-width: 44px;
    padding: 0 8px;
  }

  .nxf-root .nxf-portal__tool-text {
    display: none;
  }

  .nxf-root .nxf-portal__tool {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .nxf-root .nxf-portal__panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 55%;
    border-radius: var(--nxf-globe-radius) var(--nxf-globe-radius) 0 0;
    border-bottom: 0;
  }

  .nxf-root .nxf-portal__readout {
    top: 56px;
    right: 8px;
    left: 8px;
    min-width: 0;
    max-width: none;
    padding: 8px 10px;
  }

  .nxf-root .nxf-portal--panel-open .nxf-portal__readout {
    display: none;
  }

  .nxf-root .nxf-portal__facts {
    grid-template-columns: auto 1fr;
    gap: 1px 10px;
  }

  .nxf-root .nxf-portal__attribution,
  .nxf-root .nxf-portal--panel-open .nxf-portal__attribution {
    left: 12px;
    bottom: 4px;
    max-width: calc(100% - 60px);
  }

  .nxf-root .nxf-portal--panel-open .nxf-portal__attribution,
  .nxf-root .nxf-portal--panel-open .maplibregl-ctrl-bottom-right,
  .nxf-root .nxf-portal--panel-open .maplibregl-ctrl-bottom-left {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nxf-root .nxf-portal__segment-btn,
  .nxf-root .nxf-portal__tool {
    transition: none;
  }

  .nxf-root .nxf-portal__canvas .maplibregl-canvas {
    transition: none;
  }
}

.nxf-root .nxf-embed__placeholder,
:host .nxf-embed__placeholder {
  margin: 0 0 var(--nxf-space-2);
  font-size: 0.82rem;
  color: var(--nxf-color-fg-muted);
}

/* Consent gate: the affordance is visible only while the surface is withdrawn (data-nxf-consent="pending"). */
.nxf-root .nxf-embed__consent,
:host .nxf-embed__consent {
  display: none;
}
.nxf-root[data-nxf-consent="pending"] .nxf-embed__consent,
:host([data-nxf-consent="pending"]) .nxf-embed__consent {
  display: inline-block;
  margin: 0 0 var(--nxf-space-2);
  padding: 4px 10px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--nxf-color-fg);
  background: var(--nxf-color-surface);
  border: 1px solid var(--nxf-color-border);
  border-radius: 4px;
  cursor: pointer;
}
.nxf-root[data-nxf-consent="pending"] .nxf-embed__consent:focus-visible,
:host([data-nxf-consent="pending"]) .nxf-embed__consent:focus-visible {
  outline: 2px solid var(--nxf-color-focus, currentColor);
  outline-offset: 2px;
}
.nxf-root.nxf-embed--editor {
  display: grid;
  place-items: center;
  border: 1px dashed var(--nxf-color-border);
  border-radius: 5px;
}

.nxf-root.nxf-embed--slot {
  width: 100%;
}

.nxf-root.nxf-embed--slot .nxf-frame {
  max-height: none;
}
