/* ============================================================================
   fw-city-mist.css — the real "Ask MIST" states on Cité Fluid.

   Loads AFTER fw-world-2.css so it wins specificity ties. It only styles things
   that are absent or hidden at first paint (suggestion chips, answer states, the
   MIST block inside a district pin), so it is deliberately NOT render-blocking —
   unlike the page sheets, which carry blocking="render" for the Safari FOUC fix.

   Surface rules inherited from the page's paper restyle (fw-world-2.css §1, §4,
   §7, §8), not reinvented here:
     · white paper card + torn bottom edge, ink type
     · buttons: 4px radius, hard 2-3px offset shadow with NO blur, slight tilt
     · one accent only: --wefw2-blue (#42b1ff)
     · district pins are BLACK paper — light type inside them
   Everything new is prefixed we-mist- / we-dmist- so it can never collide with
   the page's generic class names (this theme has been bitten by bare .ic/.tt).
   ========================================================================== */

/* ---------- 1. Suggestion chips ------------------------------------------- */
/* Sit on the white card under the composer. Same chassis as .control, smaller.
   Hidden until the JS has a pool, so an empty rail never reserves space. */

.we-mist-suggest {
  margin: 12px 3px 0;
  text-align: left;
}
.we-mist-suggest[hidden] { display: none; }

.we-mist-suggest__label {
  display: block;
  margin-bottom: 8px;
  color: var(--wefw2-ink-3, #6b6a63);
  font-family: var(--wefw2-fl, "FLBold", "Arial Black", sans-serif);
  font-weight: 400;
  font-size: 12px;
  line-height: 1;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.we-mist-suggest__row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.we-mist-chip {
  max-width: 100%;
  padding: 7px 11px;
  border: 1.5px solid rgba(20, 17, 9, .2);
  border-radius: 4px;
  background: #fff;
  color: #07101a;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .38);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-align: left;
  cursor: pointer;
  transform: rotate(-.5deg);
  transition: transform .16s ease, box-shadow .16s ease;
}
.we-mist-chip:nth-child(even) { transform: rotate(.6deg); }
.we-mist-chip:hover,
.we-mist-chip:focus-visible {
  transform: translateY(-2px) rotate(-.5deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .46);
}
.we-mist-chip:nth-child(even):hover,
.we-mist-chip:nth-child(even):focus-visible { transform: translateY(-2px) rotate(.6deg); }

/* a route chip is the kind that lights the city — flag it with the one accent */
.we-mist-chip.is-route { border-color: rgba(66, 177, 255, .55); }
.we-mist-chip.is-route::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  background: var(--wefw2-blue, #42b1ff);
  rotate: 45deg;
  vertical-align: middle;
}

/* ---------- 2. The character counter ------------------------------------- */

.we-mist-count {
  margin-left: auto;
  color: var(--wefw2-ink-3, #6b6a63);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.we-mist-count[hidden] { display: none; }

/* ---------- 3. Answer / thinking / error states -------------------------- */
/* .mist-command-result is black paper (fw-world-2.css:1967). The pulse used to
   animate forever because there was no terminal state; now it only runs while
   we are genuinely waiting, and stops the moment a payload lands. */

.we-mist-result__body { min-width: 0; }

.mist-command-result .we-mist-result__body > strong {
  display: block;
  font-size: 12px;
  letter-spacing: .03em;
}

.mist-command-result[data-state='thinking'] .mist-command-result__pulse {
  animation: activity-pulse 1.25s ease-in-out infinite;
}
/* every settled state stops the pulse dead */
.mist-command-result[data-state='answer'] .mist-command-result__pulse,
.mist-command-result[data-state='routing'] .mist-command-result__pulse,
.mist-command-result[data-state='error'] .mist-command-result__pulse {
  animation: none;
}
.mist-command-result[data-state='routing'] .mist-command-result__pulse {
  background: var(--wefw2-blue, #42b1ff);
}
.mist-command-result[data-state='error'] .mist-command-result__pulse {
  background: #e0644f;
}

/* the echoed prompt while thinking reads as quoted input, not as an answer */
.mist-command-result[data-state='thinking'] #mist-command-result-copy {
  font-style: italic;
  opacity: .82;
}

.we-mist-note {
  display: block;
  margin-top: 7px;
  color: #8f98a4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.we-mist-note[hidden] { display: none; }

/* ---------- 4. Follow-up chips (inside the black result card) ------------- */

.we-mist-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.we-mist-followups[hidden] { display: none; }

.we-mist-chip--followup {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .26);
  background: none;
  color: #e7eaef;
  box-shadow: none;
  font-size: 11px;
  font-weight: 600;
  transform: none;
}
.we-mist-chip--followup:nth-child(even) { transform: none; }
.we-mist-chip--followup:hover,
.we-mist-chip--followup:focus-visible {
  border-color: var(--wefw2-blue, #42b1ff);
  background: rgba(66, 177, 255, .12);
  color: #fff;
  box-shadow: none;
  transform: none;
}
.we-mist-chip--followup:nth-child(even):hover,
.we-mist-chip--followup:nth-child(even):focus-visible { transform: none; }

/* ---------- 5. Docked composer while the city is answering --------------- */
/* When districts light up, the card must stop covering the city. It drops to
   the bottom and sheds its headline/lede, keeping the composer so the visitor
   can ask again without reopening anything. */

body.mist-work-active .mist-command-shell {
  place-items: end center;
  padding-bottom: 22px;
}
body.mist-work-active .mist-command-card {
  width: min(600px, calc(100vw - 40px));
}
body.mist-work-active .mist-command-kicker,
body.mist-work-active .mist-command-card > h2,
body.mist-work-active .mist-command-lede,
body.mist-work-active .we-mist-suggest {
  display: none;
}
body.mist-work-active .mist-command-result { margin-top: 0; }
body.mist-work-active .mist-composer { margin-top: 11px; }

/* ---------- 6. The MIST block inside a district pin ---------------------- */
/* Additive: the live-metric markup stays in the DOM and keeps being updated by
   the bundle's timer. We just swap which half is visible, so normal browsing is
   completely unaffected. */

.we-dmist { display: none; }

.district-activity.is-mist-work { width: 178px; }
.district-activity.is-mist-work .we-dmist { display: block; }
.district-activity.is-mist-work .district-activity__live,
.district-activity.is-mist-work .district-activity__primary,
.district-activity.is-mist-work .district-activity__details { display: none; }

/* keep the label legible at every zoom level the bundle drives through data-lod */
.district-activity.is-mist-work[data-lod='far'] .we-dmist,
.district-activity.is-mist-work[data-lod='medium'] .we-dmist,
.district-activity.is-mist-work[data-lod='detail'] .we-dmist { display: block; }

.we-dmist__label {
  display: block;
  margin: 7px 0 3px;
  color: var(--wefw2-blue, #42b1ff);
  font-family: var(--wefw2-fl, "FLBold", "Arial Black", sans-serif);
  font-weight: 400;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.we-dmist__head {
  display: block;
  margin-bottom: 6px;
  color: #fff;
  font-family: var(--wefw2-haas, "WeHaas", "Helvetica Neue", sans-serif);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.15;
  letter-spacing: -.015em;
}

.we-dmist__items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.we-dmist__items li {
  position: relative;
  padding-left: 9px;
  color: #c2c8d2;
  font-family: var(--wefw2-fl, "FLBold", "Arial Black", sans-serif);
  font-weight: 400;
  font-size: 9.5px;
  line-height: 1.25;
  letter-spacing: .02em;
  opacity: 0;
  animation: we-dmist-in .34s ease forwards;
  animation-delay: calc(var(--i, 0) * 90ms + 130ms);
}
.we-dmist__items li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 4px;
  height: 4px;
  background: rgba(66, 177, 255, .8);
  rotate: 45deg;
}
@keyframes we-dmist-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}

/* districts MIST is not touching recede, so the lit ones read as the answer */
body.mist-work-active .district-activity:not(.is-mist-work) {
  opacity: .24;
  transition: opacity .3s ease;
}

/* ---------- 7. Reduced motion -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .we-mist-chip { transition: none; }
  .we-dmist__items li { animation: none; opacity: 1; }
  .mist-command-result[data-state='thinking'] .mist-command-result__pulse { animation: none; }
  body.mist-work-active .district-activity:not(.is-mist-work) { transition: none; }
}

/* ---------- 8. Mobile ---------------------------------------------------- */

@media (max-width: 680px) {
  .we-mist-suggest__row { gap: 6px; }
  .we-mist-chip { font-size: 11.5px; padding: 6px 9px; }
  body.mist-work-active .mist-command-shell { padding-bottom: 12px; }
  body.mist-work-active .mist-command-card { width: calc(100vw - 20px); }
  /* the pins are already tight at 390px — MIST labels get the space instead */
  .district-activity.is-mist-work { width: 164px; }
}
