/*
 * Stage overlays [C1]: residence chips, hover card, camera dock, compass,
 * availability legend, loading and error cards. (The bajareque veil is the
 * shell's #stage-mist; chips stay hidden until the 3D fog has mostly cleared.)
 * Markup: js/ui/stage/*.js (mountStageUI). Colours come from tokens.css only.
 *
 * Placement inside the visible stage area (--stage-inset-* from layout.css):
 *   bottom-centre  dock (camera views + toolbar)
 *   bottom-right   compass, with the valley data credit link above it (exterior)
 *   top-right      availability legend
 *   centre         loading / error card
 *   bottom-left    reserved for the shell's Master Brokers credit (#stage-credit)
 */

.stage-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--font-ui);
  color: var(--ink);
  --st-glass-bg: var(--surface-glass-text);
  --st-glass-strong: var(--surface-glass-strong);
  --st-glass-border: var(--border);
}

.stage-ui [hidden] {
  display: none !important;
}

/* Focused only programmatically (a click on the 3D) to scope the camera shortcuts. */
.stage-ui:focus,
.stage-ui:focus-visible {
  outline: none;
}

.st-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Probe that measures the visible stage area (read by index.js). */
.st-safe {
  position: absolute;
  top: var(--stage-inset-top, 0px);
  right: var(--stage-inset-right, 0px);
  bottom: var(--stage-inset-bottom, 0px);
  left: var(--stage-inset-left, 0px);
  visibility: hidden;
  pointer-events: none;
}

/* Shared glass surface */
.st-presets,
.st-toolbar,
.st-compass,
.st-credits,
.st-legend,
.st-loader,
.st-card {
  border: 1px solid var(--st-glass-border);
  background: var(--st-glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--elev-1);
}

/* ------------------------------------------------------------------------ */
/* Residence chips                                                           */
/* ------------------------------------------------------------------------ */

.st-chips {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.st-chip {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
  --chip-status: var(--st-unknown);
  animation: st-chip-in var(--dur) var(--ease);
}

.st-chip[data-status="available"] { --chip-status: var(--st-available); }
.st-chip[data-status="reserved"] { --chip-status: var(--st-reserved); }
.st-chip[data-status="sold"] { --chip-status: var(--st-sold); }
.st-chip[data-status="unavailable"] { --chip-status: var(--st-unavailable); }
.st-chip[data-status="unknown"] { --chip-status: var(--st-unknown); }

.st-chip__pin {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mist);
  box-shadow: 0 0 0 1.5px var(--basalt-a58), 0 1px 3px var(--shadow-a28);
}

.st-chip__stem {
  position: absolute;
  left: -.5px;
  bottom: 0;
  width: 1px;
  height: var(--stem, 16px);
  background: linear-gradient(to top, var(--basalt-a72), var(--basalt-a32));
}

.st-chip__pill {
  position: absolute;
  left: var(--dx, 0px);
  bottom: var(--stem, 16px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin: 0;
  padding: 0 11px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--st-glass-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--elev-1);
  color: var(--ink);
  font: var(--fw-bold) var(--fs-13) / 1 var(--font-ui);
  font-variant-numeric: var(--numeric);
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

/* 44 px touch target around the 28 px pill */
.st-chip__pill::before {
  content: '';
  position: absolute;
  inset: -8px -6px;
}

.st-chip__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--chip-status);
  box-shadow: 0 0 0 2px var(--mist-a72);
}

/* Status is told by shape as well as colour (WCAG 1.4.1; e.g. available/sold are close
   for deuteranopes): ● available · ○ reserved · ■ sold · ◆ unavailable · ▬ to confirm.
   The legend repeats the same shapes next to the words. */
.st-chip[data-status="reserved"] .st-chip__dot {
  background: var(--mist);
  box-shadow: inset 0 0 0 2.5px var(--chip-status), 0 0 0 2px var(--mist-a72);
}

.st-chip[data-status="sold"] .st-chip__dot {
  border-radius: 1px;
}

.st-chip[data-status="unavailable"] .st-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  transform: rotate(45deg);
}

.st-chip[data-status="unknown"] .st-chip__dot {
  width: 10px;
  height: 3px;
  border-radius: 2px;
}

.st-chip__pill:hover,
.st-chip.is-hovered .st-chip__pill {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: var(--elev-2);
}

.st-chip__pill:focus-visible {
  /* Two-tone ring over the 3D canvas: pine | mist | pine stays visible on day sky, dusk and forest. */
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-ring);
}

.st-chip.is-selected .st-chip__pill {
  border-color: var(--pine);
  background: var(--pine);
  color: var(--pine-ink);
  box-shadow: var(--elev-2);
}

.st-chip.is-selected .st-chip__dot {
  box-shadow: 0 0 0 2px var(--white-a86);
}

.st-chip.is-selected .st-chip__pin {
  background: var(--pine);
  box-shadow: 0 0 0 2px var(--mist), 0 1px 4px var(--shadow-a28);
}

.st-chip.is-selected .st-chip__stem {
  background: var(--pine);
}

@keyframes st-chip-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Room labels on the cutaway (same pin + leader + pill as the residence chips). */
.st-chip--room .st-chip__pill {
  font-weight: var(--fw-semibold);
  letter-spacing: normal;
}

.st-chip--room .st-chip__dot[hidden] {
  display: none;
}

/* Known-issue marker (PB-3BR Baño 2 en revisión): neutral olive with a dashed ring,
   distinct from every availability colour and shape. */
.st-chip--room[data-status="review"] .st-chip__dot {
  width: 10px;
  height: 10px;
  background: var(--olive);
  box-shadow: none;
  outline: 1.5px dashed var(--olive);
  outline-offset: 1.5px;
}

/* "Candidato" chip for a staged per-apartment model (review mode only). */
.st-model {
  position: absolute;
  top: var(--stage-inset-top, var(--sp-4));
  right: var(--stage-inset-right, var(--sp-4));
  pointer-events: none;
  animation: st-fade-in var(--dur) var(--ease);
}

.st-model__chip {
  min-height: 32px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--elev-1);
}

.st-model__chip:focus-visible {
  /* Two-tone ring over the 3D canvas: pine | mist | pine stays visible on day sky, dusk and forest. */
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-ring);
}

/* ------------------------------------------------------------------------ */
/* Hover card                                                                */
/* ------------------------------------------------------------------------ */

.st-card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  display: grid;
  gap: var(--sp-2);
  width: 252px;
  max-width: calc(100% - 2 * var(--sp-4));
  padding: var(--sp-3) 14px;
  border-radius: var(--r-card);
  background: var(--st-glass-strong);
  box-shadow: var(--elev-2);
  pointer-events: none;
  --card-dot: var(--st-unknown);
  --card-tint: var(--st-unknown-tint);
  --card-ink: var(--st-unknown-ink);
  /* Positioned with an inline transform: animate opacity only. */
  animation: st-chip-in var(--dur-fast) var(--ease);
}

.st-card[data-status="available"] { --card-dot: var(--st-available); --card-tint: var(--st-available-tint); --card-ink: var(--st-available-ink); }
.st-card[data-status="reserved"] { --card-dot: var(--st-reserved); --card-tint: var(--st-reserved-tint); --card-ink: var(--st-reserved-ink); }
.st-card[data-status="sold"] { --card-dot: var(--st-sold); --card-tint: var(--st-sold-tint); --card-ink: var(--st-sold-ink); }
.st-card[data-status="unavailable"] { --card-dot: var(--st-unavailable); --card-tint: var(--st-unavailable-tint); --card-ink: var(--st-unavailable-ink); }

.st-card__head {
  display: grid;
  gap: 2px;
}

.st-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-16);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  font-variant-numeric: var(--numeric);
}

.st-card__place {
  color: var(--ink-muted);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-wide);
}

.st-card__commerce {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.st-card__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--card-tint);
  color: var(--card-ink);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
}

.st-card__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--card-dot);
}

.st-card__price {
  color: var(--price-ink);
  font-size: var(--fs-16);
  font-weight: var(--fw-bold);
  font-variant-numeric: var(--numeric);
  white-space: nowrap;
}

/* "Lista 22 sep 2026": a visible price never travels without its list date. */
.st-card__pricedate {
  display: block;
  margin-top: -2px;
  color: var(--ink-muted);
  font-size: var(--fs-12);
  text-align: right;
  font-variant-numeric: var(--numeric);
}

.st-card__price.is-muted {
  color: var(--ink-muted);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
}

.st-card__specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  color: var(--ink-muted);
  font-size: var(--fs-13);
  font-variant-numeric: var(--numeric);
}

.st-card__spec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.st-card__spec .icon {
  width: 16px;
  height: 16px;
  color: var(--olive);
}

.st-card__hint {
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: var(--fs-12);
}

@media (hover: none) {
  .st-card__hint {
    display: none;
  }
}

/* ------------------------------------------------------------------------ */
/* Availability legend (top-right)                                          */
/* ------------------------------------------------------------------------ */

.st-legend {
  position: absolute;
  top: var(--stage-inset-top, var(--sp-4));
  right: var(--stage-inset-right, var(--sp-4));
  display: grid;
  gap: 6px;
  min-width: 184px;
  padding: 10px var(--sp-3) var(--sp-3);
  border-radius: var(--r-card);
  pointer-events: auto;
  transition: right var(--dur-slow) var(--ease);
  animation: st-fade-in var(--dur) var(--ease);
}

.st-legend__title {
  color: var(--ink-muted);
  font-size: var(--fs-12);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.st-legend__list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.st-legend__row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-13);
  --legend-color: var(--st-unknown);
  --legend-tint: var(--st-unknown-tint);
}

.st-legend__row[data-status="available"] { --legend-color: var(--st-available); --legend-tint: var(--st-available-tint); }
.st-legend__row[data-status="reserved"] { --legend-color: var(--st-reserved); --legend-tint: var(--st-reserved-tint); }
.st-legend__row[data-status="sold"] { --legend-color: var(--st-sold); --legend-tint: var(--st-sold-tint); }
.st-legend__row[data-status="unavailable"] { --legend-color: var(--st-unavailable); --legend-tint: var(--st-unavailable-tint); }

/* Swatch shapes match the residence chips (● ○ ■ ◆ ▬), so status never relies on hue alone. */
.st-legend__dot {
  justify-self: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--legend-color);
}

.st-legend__row[data-status="reserved"] .st-legend__dot {
  background: var(--legend-tint);
  box-shadow: inset 0 0 0 2.5px var(--legend-color);
}

.st-legend__row[data-status="sold"] .st-legend__dot {
  border-radius: 2px;
}

.st-legend__row[data-status="unavailable"] .st-legend__dot {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  transform: rotate(45deg);
}

.st-legend__row[data-status="unknown"] .st-legend__dot {
  width: 12px;
  height: 4px;
  border-radius: 2px;
}

.st-legend__count {
  font-weight: var(--fw-bold);
  font-variant-numeric: var(--numeric);
}

.st-legend__asof {
  color: var(--ink-muted);
  font-size: var(--fs-12);
  font-variant-numeric: var(--numeric);
}

/* ------------------------------------------------------------------------ */
/* Dock: camera views + toolbar (bottom-centre)                             */
/* ------------------------------------------------------------------------ */

.st-dock-zone {
  position: absolute;
  left: var(--stage-inset-left, var(--sp-4));
  right: var(--stage-inset-right, var(--sp-4));
  bottom: var(--stage-inset-bottom, var(--sp-4));
  display: flex;
  justify-content: center;
  pointer-events: none;
  container: st-dock / inline-size;
  transition:
    left var(--dur-slow) var(--ease),
    right var(--dur-slow) var(--ease);
}

.st-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
  pointer-events: none;
  transition: margin-bottom var(--dur-slow) var(--ease);
}

.st-presets {
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  border-radius: var(--r-pill);
  pointer-events: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.st-presets::-webkit-scrollbar {
  display: none;
}

.st-preset {
  flex: none;
  min-height: 36px;
  margin: 0;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-muted);
  font: var(--fw-semibold) var(--fs-13) / 1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: center;
  transition:
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.st-preset:hover {
  background: var(--hover);
  color: var(--ink);
}

.st-preset[aria-pressed="true"] {
  background: var(--pine);
  color: var(--pine-ink);
}

.st-preset:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

/* The active preset is pine: its ring must be mist, not pine on pine. */
.st-preset[aria-pressed="true"]:focus-visible {
  box-shadow: inset 0 0 0 2px var(--focus-ring-outer), inset 0 0 0 4px var(--focus-ring);
}

.st-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  pointer-events: auto;
}

.st-toolbar__group,
.st-tod {
  display: flex;
  gap: 2px;
}

.st-toolbar__divider {
  width: 1px;
  height: 24px;
  margin: 0 var(--sp-1);
  background: var(--border-strong);
}

.st-tool {
  display: grid;
  place-items: center;
  width: var(--touch, 44px);
  height: var(--touch, 44px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.st-tool:hover {
  background: var(--hover);
}

.st-tool:active {
  background: var(--press);
  transform: scale(.94);
}

.st-tool:focus-visible {
  /* Two-tone ring over the 3D canvas: pine | mist | pine stays visible on day sky, dusk and forest. */
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--focus-ring);
}

.st-tool--tod[aria-pressed="true"] {
  background: var(--pine);
  color: var(--pine-ink);
}

/* Narrow stage area on tablet/desktop: rise above the credit (left) and compass (right). */
@media (min-width: 760px) {
  @container st-dock (max-width: 940px) {
    .st-dock {
      margin-bottom: 64px;
    }

    /* The valley data credit sits above the compass: rise above both. */
    .stage-ui[data-credits] .st-dock {
      margin-bottom: 120px;
    }
  }
}

/* Very narrow: keep the rotate buttons (orbit must not be drag-only, WCAG 2.5.1),
   zoom and overview; day/dusk moves out (Ajustes, and the ☰ menu on phones). */
@container st-dock (max-width: 380px) {
  .st-tod,
  .st-toolbar__divider {
    display: none;
  }
}

/* Cutaway: no views row, no light toggle. */
.stage-ui[data-mode="cutaway"] .st-dock {
  margin-bottom: 0;
}

/* Table open: keep only the toolbar, low and out of the way. */
.stage-ui[data-list] .st-presets {
  display: none;
}

/* ------------------------------------------------------------------------ */
/* Compass (bottom-right)                                                    */
/* ------------------------------------------------------------------------ */

.st-corner {
  position: absolute;
  right: var(--stage-inset-right, var(--sp-4));
  bottom: var(--stage-inset-bottom, var(--sp-4));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  pointer-events: none;
  transition: right var(--dur-slow) var(--ease);
}

.st-compass {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.st-compass:hover {
  box-shadow: var(--elev-2);
}

.st-compass:active {
  transform: scale(.96);
}

.st-compass:focus-visible {
  /* Two-tone ring over the 3D canvas: pine | mist | pine stays visible on day sky, dusk and forest. */
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-ring);
}

.st-compass__svg {
  display: block;
  width: 48px;
  height: 48px;
  overflow: visible;
}

.st-compass__ring {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1;
}

.st-compass__tick {
  stroke: var(--basalt-a32);
  stroke-width: 1;
  stroke-linecap: round;
}

.st-compass__needle {
  fill: var(--timber);
}

.st-compass__n {
  fill: var(--timber);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: var(--fw-bold);
}

.st-compass__tick--major {
  stroke: var(--ink-muted);
  stroke-width: 1.5;
}

.st-compass__notch {
  fill: var(--pine);
}

/* Valley data credit (Copernicus), above the compass; opens Notas y fuentes › credits. */
.st-credits {
  display: inline-flex;
  align-items: center;
  max-width: min(17em, 40vw);
  min-height: 28px;
  margin: 0;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-12);
  line-height: 1.3;
  text-align: right;
  cursor: pointer;
  pointer-events: auto;
}

.st-credits:hover .st-credits__lead,
.st-credits:hover .st-credits__sources {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.st-credits:focus-visible {
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-ring);
}

.st-credits__info {
  flex: none;
  margin-left: .35em;
  color: var(--ink-muted);
}

/*
 * Imagery / open-data attribution (Esri "Powered by Esri | sources", © OpenStreetMap
 * contributors …). Required on screen while those layers are drawn, so it never collapses to
 * an icon, including on phones.
 */
.st-attrib {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  max-width: min(36em, 72vw);
  margin: 0;
  padding: 3px 8px;
  border: 1px solid var(--st-glass-border);
  border-radius: 8px;
  background: var(--st-glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
  pointer-events: auto;
}

.st-attrib[hidden] {
  display: none;
}

.st-attrib a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.st-attrib a:focus-visible {
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 1px;
}

/* ------------------------------------------------------------------------ */
/* Loading and error (centre of the stage area)                             */
/* ------------------------------------------------------------------------ */

.st-center {
  position: absolute;
  top: var(--stage-inset-top, 0px);
  right: var(--stage-inset-right, 0px);
  bottom: var(--stage-inset-bottom, 0px);
  left: var(--stage-inset-left, 0px);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  pointer-events: none;
}

.st-loader {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: min(340px, 100%);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-panel);
  box-shadow: var(--elev-2);
  pointer-events: auto;
  animation: st-fade-in var(--dur) var(--ease);
}

.st-loader__spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid var(--pine-a12);
  border-top-color: var(--pine);
  border-radius: 50%;
  animation: st-spin 900ms linear infinite;
}

.st-loader__text {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.st-loader__label {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
}

.st-loader__bytes {
  color: var(--ink-muted);
  font-size: var(--fs-12);
  font-variant-numeric: var(--numeric);
}

.st-loader__track {
  position: relative;
  height: 3px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--basalt-a08);
}

.st-loader__bar {
  position: absolute;
  inset: 0;
  background: var(--pine);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur) var(--ease);
}

.st-loader[data-indeterminate] .st-loader__bar {
  width: 36%;
  transform: none;
  animation: st-indeterminate 1.4s var(--ease-in-out) infinite;
}

.st-error {
  display: grid;
  gap: var(--sp-3);
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--st-glass-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--elev-2);
  pointer-events: auto;
  animation: st-fade-in var(--dur) var(--ease);
}

.st-error__brand {
  line-height: 0;
}

.st-error__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-20);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}

.st-error__message,
.st-error__hint {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
}

.st-error__hint {
  font-size: var(--fs-13);
}

.st-error__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.st-error__details {
  color: var(--ink-muted);
  font-size: var(--fs-12);
}

.st-error__details summary {
  cursor: pointer;
}

.st-error__details code {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-12);
  overflow-wrap: anywhere;
}

.st-error__footer {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.st-error__footer .brand-credit--inline {
  flex-wrap: wrap;
  min-height: var(--touch, 44px);
  padding: 0;
  border: 0;
  background: none;
}

/* ------------------------------------------------------------------------ */
/* Shared motion                                                             */
/* ------------------------------------------------------------------------ */

@keyframes st-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes st-spin {
  to { transform: rotate(360deg); }
}

@keyframes st-indeterminate {
  from { transform: translateX(-100%); }
  to { transform: translateX(280%); }
}

/* ------------------------------------------------------------------------ */
/* Responsive                                                                */
/* ------------------------------------------------------------------------ */

@media (pointer: coarse) {
  .st-preset,
  .st-model__chip,
  .st-credits {
    min-height: var(--touch, 44px);
  }
}

@media (max-width: 759px) {
  /* The compass column sits bottom-right; the dock uses the rest. */
  .st-dock-zone {
    right: calc(var(--stage-inset-right, var(--sp-2)) + 56px);
  }

  .st-compass {
    width: 48px;
    height: 48px;
  }

  /* Phones: the compass column is narrow; the credit shows "Datos ⓘ" (full name in its label). */
  .st-credits {
    max-width: none;
    padding: 3px 6px;
  }

  .st-credits__sources {
    display: none;
  }

  .st-attrib {
    max-width: calc(100vw - 2 * var(--sp-2, 8px));
    font-size: 10px;
  }

  .st-compass__svg {
    width: 42px;
    height: 42px;
  }

  .st-legend {
    min-width: 0;
    padding: var(--sp-2) 10px;
  }

  .st-legend__asof {
    display: none;
  }

  .st-card {
    width: 228px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-ui *,
  .stage-ui *::before,
  .stage-ui *::after {
    animation: none !important;
    transition: none !important;
  }

  .st-loader[data-indeterminate] .st-loader__bar {
    width: 100%;
    opacity: .4;
  }
}
